Struct Command2

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

Fields§

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

Implementations§

Source§

impl<'a, T1: Input, T2: Input> Command2<'a, T1, T2>

Source

pub fn input<T3: Input>(self, in3: T3) -> Command3<'a, T1, T2, T3>

Source

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

Source

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

Trait Implementations§

Source§

impl<'a, T1, T2> ParserInfo for Command2<'a, T1, T2>
where T1: Input, T2: 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, T2> Freeze for Command2<'a, T1, T2>
where T1: Freeze, T2: Freeze,

§

impl<'a, T1, T2> !RefUnwindSafe for Command2<'a, T1, T2>

§

impl<'a, T1, T2> !Send for Command2<'a, T1, T2>

§

impl<'a, T1, T2> !Sync for Command2<'a, T1, T2>

§

impl<'a, T1, T2> Unpin for Command2<'a, T1, T2>
where T1: Unpin, T2: Unpin,

§

impl<'a, T1, T2> !UnwindSafe for Command2<'a, T1, T2>

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.