Struct Command1

Source
pub struct Command1<'a, T1: Input> {
    pub docs: DocInfo,
    pub subcommands: Vec<Box<dyn Cmd + 'a>>,
    pub handler: Option<Box<dyn FnMut(&T1) -> CliResult<()> + 'a>>,
    pub in1: T1,
}

Fields§

§docs: DocInfo§subcommands: Vec<Box<dyn Cmd + 'a>>§handler: Option<Box<dyn FnMut(&T1) -> CliResult<()> + 'a>>§in1: T1

Implementations§

Source§

impl<'a, T1: Input> Command1<'a, T1>

Source

pub fn input<T2: Input>(self, in2: T2) -> Command2<'a, T1, T2>

Source

pub fn handler<F>(self, handler: F) -> Self
where F: FnMut(&T1) -> CliResult<()> + 'a,

Source

pub fn subcommand<C: Cmd + 'a>(self, sub: C) -> Self

Trait Implementations§

Source§

impl<'a, T1> ParserInfo for Command1<'a, T1>
where T1: Input,

Source§

fn docs(&self) -> &DocInfo

Source§

fn symbols(&mut self) -> Vec<&mut dyn Input>

Source§

fn subcommand_docs(&self) -> Vec<DocInfo>

Source§

fn call_handler(&mut self) -> CliResult<()>

Source§

fn push_parent(&mut self, parents: &[String])

Source§

fn complete_subcommand( &mut self, sub_idx: usize, tokens: &[String], ) -> Result<Vec<CompOut>, CliError>

Source§

fn parse_subcommand( &mut self, sub_idx: usize, tokens: &[String], ) -> Result<(), CliError>

Auto Trait Implementations§

§

impl<'a, T1> Freeze for Command1<'a, T1>
where T1: Freeze,

§

impl<'a, T1> !RefUnwindSafe for Command1<'a, T1>

§

impl<'a, T1> !Send for Command1<'a, T1>

§

impl<'a, T1> !Sync for Command1<'a, T1>

§

impl<'a, T1> Unpin for Command1<'a, T1>
where T1: Unpin,

§

impl<'a, T1> !UnwindSafe for Command1<'a, T1>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<C> Cmd for C
where C: ParserInfo,

Source§

fn gen_help(&mut self) -> CliError

Source§

fn parse(&mut self)

Source§

fn complete_args(&mut self, tokens: &[String]) -> CliResult<Vec<CompOut>>

Source§

fn parse_args(&mut self, tokens: &[String]) -> CliResult<()>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.