Skip to main content

Tool

Struct Tool 

Source
pub struct Tool {
    pub name: &'static str,
    pub verb: &'static str,
    pub section: u8,
    pub about: &'static str,
    pub usage_exit: u8,
    pub command: fn() -> Command,
    pub run: fn(&ArgMatches) -> Result<Outcome, CliError>,
}
Expand description

One dotted name, and the program behind it.

Fields§

§name: &'static str

The name it is installed and invoked under: mkfs.<fs>.

§verb: &'static str

The word that selects it after the repository name: rust-fs-<fs> mkfs ....

§section: u8

Its manual section: 8 for mkfs.* and fsck.*, 1 otherwise.

§about: &'static str

One line for the repository’s help.

§usage_exit: u8

The exit status of a wrong command line: 2 by the shared contract, but a tool whose name promises another scheme keeps that scheme’s (fsck.* answers 16, as fsck(8) documents, because 2 there means “reboot”).

§command: fn() -> Command

Its arguments. The name and version are set by the caller.

§run: fn(&ArgMatches) -> Result<Outcome, CliError>

Run it. Ok is printed on stdout in the format asked for; Err as a structured error on stderr, with its code as the exit status.

Auto Trait Implementations§

§

impl Freeze for Tool

§

impl RefUnwindSafe for Tool

§

impl Send for Tool

§

impl Sync for Tool

§

impl Unpin for Tool

§

impl UnsafeUnpin for Tool

§

impl UnwindSafe for Tool

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.