Serde_json - no TryInto?

It'd be kinda nice if serde_json had all the TryIntos. (altho we wouldn't be able to use those yet anyway, because our code just can't use them in current stable rust because reasons... eh it is what it is .-. but it'd be cool to have them.)

You could submit a pull request for this. It might need to be behind a cfg gate because TryInto was stabilized in Rust 1.34, while serde_json supports Rust 1.31. Fortunately there is already some machinery for this in the build.rs script.

Not exactly a golden ticket, but I created the standback crate for things like this. It has an identical definition of tons of things (including TryFrom/TryInto) for compilers prior the stabilization point. On any compiler post-stabilization, it's just re-exported (so it's transparent to the user and fully compatible with other crates).

No idea if dtolnay or others want this, but it's worth considering imo.

4 Likes