Just realized stabilizing `.try_from()` will be really cool for custom types to build in serde conversions: use my_crate::CustomStruct; let p = "./some/path.json"; let custom: CustomStruct = fs::read_to_string(p)?.try_into()?;
It'll make encapsulation a little bit better. For example with my `webmanifest` module I don't want people to have to also remember to import `serde` + `serde_json`. So we need to create a custom `from_string()` method, which would be better served using the TryFrom trait!
-
-
No need to wait for TryFrom for that specific case -- impl `std::str::FromStr`! This let's you write `let custom: CustomStruct = fs::read_to_string(p)?.parse()?;`!
-
Oh awesome!
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.