Skip to main content

Launcher

Struct Launcher 

Source
pub struct Launcher<G: Command> { /* private fields */ }
Expand description

Launcher before any subcommand has been registered.

Calling Launcher::command transitions to LauncherWithSubs.

Implementations§

Source§

impl<G: Command + 'static> Launcher<G>

Source

pub fn of() -> Self

Source

pub fn command<S>(self, name: &str) -> LauncherWithSubs<G>
where S: Command + SubCommandOf<G> + 'static,

Register the first subcommand, moving into subcommand mode.

Source

pub fn command_with_description<S>( self, name: &str, description: &str, ) -> LauncherWithSubs<G>
where S: Command + SubCommandOf<G> + 'static,

Like Launcher::command but with a description override.

Source

pub fn parse(&self, args: &[String]) -> Result<G>

Parse args into a G without running.

Source

pub fn execute(self) -> !
where G: Runnable,

Parse std::env::args(), run G::run, and exit. Parse-origin failures (including those from G::from_parsed, e.g. missing required args, invalid typed values) route through the help printer with exit code 2. Runtime failures from G::run exit with code 1 and no help banner.

Auto Trait Implementations§

§

impl<G> Freeze for Launcher<G>

§

impl<G> RefUnwindSafe for Launcher<G>
where G: RefUnwindSafe,

§

impl<G> Send for Launcher<G>
where G: Send,

§

impl<G> Sync for Launcher<G>
where G: Sync,

§

impl<G> Unpin for Launcher<G>
where G: Unpin,

§

impl<G> UnsafeUnpin for Launcher<G>

§

impl<G> UnwindSafe for Launcher<G>
where G: UnwindSafe,

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<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.