pub struct Arg {
pub info: ArgInfo,
pub validators: Vec<Box<dyn Validator>>,
pub completers: Vec<Box<dyn Completer>>,
pub prompters: Vec<Box<dyn Prompter>>,
}Fields§
§info: ArgInfo§validators: Vec<Box<dyn Validator>>§completers: Vec<Box<dyn Completer>>§prompters: Vec<Box<dyn Prompter>>Implementations§
Source§impl Arg
impl Arg
Sourcepub fn positional(name: impl Into<String>, ty: ArgType) -> Self
pub fn positional(name: impl Into<String>, ty: ArgType) -> Self
Create a positional argument
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the description for the argument
pub fn aliases(self, aliases: Vec<String>) -> Self
pub fn ty(self, ty: ArgType) -> Self
Sourcepub fn env(self, env_var: impl Into<String>) -> Self
pub fn env(self, env_var: impl Into<String>) -> Self
Set environment variable to read default value from
Sourcepub fn enums(self, options: Vec<(impl Into<String>, impl Into<String>)>) -> Self
pub fn enums(self, options: Vec<(impl Into<String>, impl Into<String>)>) -> Self
Set enum options for this argument (label, value)
Sourcepub fn validator(self, v: Box<dyn Validator + 'static>) -> Self
pub fn validator(self, v: Box<dyn Validator + 'static>) -> Self
Set a validator (accepts closures or Validator trait implementations)
Auto Trait Implementations§
impl Freeze for Arg
impl !RefUnwindSafe for Arg
impl !Send for Arg
impl !Sync for Arg
impl Unpin for Arg
impl !UnwindSafe for Arg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more