Expand description
A structure to store parameters
Fields
key: String
filename: String
Implementations
sourceimpl Param
impl Param
sourcepub fn new(matches: &ArgMatches) -> Result<Param, &'static str>
pub fn new(matches: &ArgMatches) -> Result<Param, &'static str>
Creates a new instance of an Param.
Examples
let matches = Command::new("myapp")
.arg(
Arg::with_name("KEY")
.help("Key to query from the TOML file")
.required(true)
.index(1),
)
.arg(
Arg::with_name("FILE")
.help("A TOML file to load")
.required(true)
.index(2),
)
.get_matches_from(vec!["myapp", "key", "a.toml"]);
let param = Param::new(&matches).unwrap();
assert_eq!(param.key, "key");
assert_eq!(param.filename, "a.toml");
Auto Trait Implementations
impl RefUnwindSafe for Param
impl Send for Param
impl Sync for Param
impl Unpin for Param
impl UnwindSafe for Param
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more