I have a structure:
pub struct Config {
files: Vec<String>,
....
}
I use Clap library to get parameters from the command line
.arg(
Arg::with_name("files")
.value_name("FILE")
.help("Input file(s)")
.multiple(true)
.default_value("-"),
)
when I try to assign values to struct:
Config {
files: matches.value_of_lossy("files").unwrap(),
....
I got the following error:
error[E0308]: mismatched types
--> src/lib.rs:42:16
|
42 | files: matches.value_of_lossy("files").unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec<String>`, found `Cow<'_, str>`
|
= note: expected struct `Vec<String>`
found enum `Cow<'_, str>`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `catr` (lib) due to previous error
How can I get the string Vector from Clap? I do not understand how to transform a Cow and use it.