bottlerocket icon indicating copy to clipboard operation
bottlerocket copied to clipboard

modeled_types: Use FromStr instead of TryFrom<&str>

Open iliana opened this issue 5 years ago • 3 comments

FromStr and TryFrom<&str> are functionally equivalent traits, but the former has existed since Rust 1.0.0 and has much wider support across the ecosystem; serde_plain is a key example of this.

iliana avatar Aug 22 '20 00:08 iliana

Can I try to start this change?

matheusmonte avatar Nov 30 '21 13:11 matheusmonte

@matheusmonte Sure, thanks! Let us know if you have any questions or troubles.

tjkirch avatar Nov 30 '21 17:11 tjkirch

Additional testing underway.

mchaker avatar Sep 20 '22 19:09 mchaker

Have we fully vetted that this is the right thing to do?

In favor of TryFrom?

  • https://internals.rust-lang.org/t/pre-rfc-deprecate-fromstr-in-favor-of-tryfrom-str/12331

In favor of FromStr?

  • https://stackoverflow.com/a/71487402

Ambiguous?

  • https://stackoverflow.com/a/67386103

webern avatar Oct 12 '22 17:10 webern

@mchaker is this still being worked on? Or can it be closed?

stmcginnis avatar Dec 19 '22 17:12 stmcginnis

@stmcginnis It turned out that, when I attempted fixing this issue previously, much more involved testing was required for this issue than I thought.

I'm currently working on issue 1703, and can focus on this again after I complete that issue.

mchaker avatar Dec 19 '22 18:12 mchaker

The way we have modeled types set up currently, I'm pretty sure all of these impls are defined and it's an implementation detail as to how we go about it. I'm going to close this because I don't think it's relevant anymore (the code may have been different in Aug 2020). Re-open if I'm wrong. Thanks.

webern avatar Dec 28 '22 20:12 webern