Using a from_str parser for an Option field results in the following:
use structopt::StructOpt;
#[derive(Debug)]
struct A {}
impl From<&str> for A {
fn from(a: &str) -> A {
// ...
A {}
}
}
#[derive(Debug, StructOpt)]
struct Opt {
#[structopt(parse(from_str))]
a: Option<A>,
}
error[E0277]: the trait bound `A: std::convert::From<&&str>` is not satisfied
--> src/lib.rs:13:17
|
13 | #[derive(Debug, StructOpt)]
| ^^^^^^^^^ the trait `std::convert::From<&&str>` is not implemented for `A`
|
= help: the following implementations were found:
<A as std::convert::From<&str>>
= note: required by `std::convert::From::from`
md5-440378ef64ed62d6c91840a8d42e5bfb
rust 1.33
structopt 0.2.14
Looks like a bug.
Got it.
I'll publish v0.2.15 when my email is validated by crates.io (hopefully within 2 hours).
Thanks for the quick reply and fix!
v0.2.15 published. Thanks for reporting, and enjoy!
Most helpful comment
Got it.