I'm using Rust's structopt crate, but when I try to compile examples I'm getting the following error,
error[E0277]: the trait bound `String: From<&OsStr>` is not satisfied
--> bin/seq.rs:21:36
|
21 | #[structopt(short, long, parse(from_os_str))]
| ^^^^^^^^^^^ the trait `From<&OsStr>` is not implemented for `String`
|
= help: the following implementations were found:
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>
<String as From<Box<str>>>
and 2 others
note: required by `from`
You can convert a
Stringinto aOsStringwith an infallible conversion, but you can not convert aOsStringinto aString.This is because an
OsStraccepts things that are not validStringsso there is no way to ensure anOsStrthatstructoptparses into can be converted to aString.You likely don't need to
parse()at all,Not