A utility crate which implement a simple FromStrSequential
trait similar to FromStr
. Used on enums with unit and un-named variants, and try to convert the string to each variant sequentially (from top to bottom variant). For unit variant,
the string must be the variant name (case-insentive). For un-named variants, the string must match the FromStr
implementation of the un-named type.
This crate was initially released to allow multiple input formats for clap::Command
```rust use fromstrsequential::FromStrSequential;
enum Foo { Bar, Baz(usize), }
asserteq!(Foo::Bar, Foo::fromstrsequential("bar").unwrap()); asserteq!(Foo::Bar, Foo::fromstrsequential("BaR").unwrap()); asserteq!(Foo::Baz(100), Foo::fromstr_sequential("100").unwrap()); ```