pub struct CmdSpec<'a, Ctx: ?Sized> { /* private fields */ }Expand description
Command specification.
Implementations§
Source§impl<'a, Ctx: ?Sized> CmdSpec<'a, Ctx>
impl<'a, Ctx: ?Sized> CmdSpec<'a, Ctx>
pub fn new(name: &'a str) -> Self
pub fn help(self, s: &'a str) -> Self
pub fn alias(self, a: &'a str) -> Self
pub fn opt(self, o: OptSpec<'a, Ctx>) -> Self
pub fn pos(self, p: PosSpec<'a, Ctx>) -> Self
pub fn subcmd(self, c: Self) -> Self
pub fn group(self, name: &'a str, mode: GroupMode) -> Self
Sourcepub fn validator<F, E>(self, cb: F) -> Self
pub fn validator<F, E>(self, cb: F) -> Self
Set per-command validator returning a displayable error (converted into Error::User).
Sourcepub fn validator_try<F, E>(self, cb: F) -> Self
pub fn validator_try<F, E>(self, cb: F) -> Self
Set per-command validator returning a typed error (boxed into Error::UserAny).
Sourcepub fn handler<F>(self, cb: F) -> Self
pub fn handler<F>(self, cb: F) -> Self
Set a leaf command handler. Only the selected leaf handler is executed.
Sourcepub fn handler_try<F, E>(self, cb: F) -> Self
pub fn handler_try<F, E>(self, cb: F) -> Self
Set a leaf command handler with a typed error (boxed into Error::UserAny).
pub fn get_name(&self) -> &str
pub fn get_help(&self) -> Option<&str>
pub fn get_aliases(&self) -> &[&'a str]
pub fn get_opts(&self) -> &[OptSpec<'a, Ctx>]
pub fn get_positionals(&self) -> &[PosSpec<'a, Ctx>]
pub fn get_subcommands(&self) -> &[Self]
pub fn get_groups(&self) -> &[GroupDecl<'a>]
pub fn get_validator(&self) -> Option<&CmdValidatorFn<'a>>
pub fn get_handler(&self) -> Option<&CmdHandlerFn<'a, Ctx>>
pub fn find_sub(&self, needle: &str) -> Option<&Self>
Auto Trait Implementations§
impl<'a, Ctx> Freeze for CmdSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> !RefUnwindSafe for CmdSpec<'a, Ctx>
impl<'a, Ctx> !Send for CmdSpec<'a, Ctx>
impl<'a, Ctx> !Sync for CmdSpec<'a, Ctx>
impl<'a, Ctx> Unpin for CmdSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> !UnwindSafe for CmdSpec<'a, Ctx>
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