pub enum Nargs {
Count(usize),
Variadic,
Optional,
}Expand description
Specifies how many arguments a parameter consumes.
This enum corresponds to Python Click’s nargs parameter:
Count(1)is the default (single value)Variadiccorresponds tonargs=-1Optionalcorresponds tonargs=?(zero or one value)
Variants§
Count(usize)
Exactly N values (default is 1).
Variadic
Zero or more values (Python’s nargs=-1).
All remaining arguments are collected.
Optional
Optional single value (Python’s nargs=?).
Zero or one value; if not provided, uses the default.
Implementations§
Source§impl Nargs
impl Nargs
Sourcepub fn is_variadic(&self) -> bool
pub fn is_variadic(&self) -> bool
Returns true if this nargs accepts zero or more values.
Sourcepub fn is_optional(&self) -> bool
pub fn is_optional(&self) -> bool
Returns true if this nargs is optional (zero or one).
Trait Implementations§
impl Copy for Nargs
impl Eq for Nargs
impl StructuralPartialEq for Nargs
Auto Trait Implementations§
impl Freeze for Nargs
impl RefUnwindSafe for Nargs
impl Send for Nargs
impl Sync for Nargs
impl Unpin for Nargs
impl UnsafeUnpin for Nargs
impl UnwindSafe for Nargs
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