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 const 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(self, cb: CmdValidator) -> Self
pub fn validator(self, cb: CmdValidator) -> Self
Set per-command validator (renamed to validator for consistency).
Sourcepub fn handler(self, cb: CmdHandler<Ctx>) -> Self
pub fn handler(self, cb: CmdHandler<Ctx>) -> Self
Set a leaf command handler. Only the selected leaf handler is executed.
pub const fn get_name(&self) -> &str
pub const 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<CmdValidator>
pub fn get_handler(&self) -> Option<CmdHandler<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>where
Ctx: ?Sized,
impl<'a, Ctx> Send for CmdSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> Sync for CmdSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> Unpin for CmdSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> UnwindSafe for CmdSpec<'a, Ctx>where
Ctx: ?Sized,
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