Struct cli_rs::command::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) -> Selfwhere 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<(), CliError>

source§

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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<C> Cmd for Cwhere C: ParserInfo,

source§

fn print_help(&mut self) -> CliError

source§

fn parse(&mut self)

source§

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

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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.