Where I would like QuadraticArguments to be an enum like this as I need 2 possible input 'cases'
#[derive(Parser)]
pub enum QuadraticArguments {
Input {
#[arg(short,long)]
input : String
},
Named {
#[arg(short)]
a : Option<String>,
#[arg(short)]
b : Option<String>,
#[arg(short)]
c : Option<String>,
}
}
So I have tried to derive ArgEnum , ValueEnum but both don't compile / work.
I have tried searching the answer on different websites and even the clap documentations but I see no mention to solve this. Thank you for your help in advance !
No QuadraticArguments and its fields ilke QuadraticArguments::Input and QuadraticArguments::Named should be possible arguments given like
The general way it should be
cargo run quadratic -i "input"
cargo run quadratic -a 2 -b 3
The cargo run quadratic part is done , and not the issue
the method `value_parser` exists for reference `&&&&&&_AutoValueParser<QuadraticArguments>`, but its trait bounds were not satisfied
the following trait bounds were not satisfied:
`QuadraticArguments: ValueEnum`
which is required by `&&&&&_AutoValueParser<QuadraticArguments>: clap::builder::via_prelude::_ValueParserViaValueEnum`
`QuadraticArguments: ValueParserFactory`
which is required by `&&&&&&_AutoValueParser<QuadraticArguments>: clap::builder::via_prelude::_ValueParserViaFactory`
`QuadraticArguments: From<OsString>`
which is required by `&&&&_AutoValueParser<QuadraticArguments>: clap::builder::via_prelude::_ValueParserViaFromOsString`
`QuadraticArguments: From<&'s std::ffi::OsStr>`
which is required by `&&&_AutoValueParser<QuadraticArguments>: clap::builder::via_prelude::_ValueParserViaFromOsStr`
`QuadraticArguments: From<std::string::String>`
which is required by `&&_AutoValueParser<QuadraticArguments>: clap::builder::via_prelude::_ValueParserViaFromString`
`QuadraticArguments: From<&'s str>`
which is required by `&_AutoValueParser<QuadraticArguments>: clap::builder::via_prelude::_ValueParserViaFromStr`
`QuadraticArguments: FromStr`
which is required by `_AutoValueParser<QuadraticArguments>: clap::builder::via_prelude::_ValueParserViaParse`
I tried implementing FromStr but then I still get errors, and I am sure there a better way to do this , then implementing those 5 traits seperatly