Skip to main content

RunWith

Trait RunWith 

Source
pub trait RunWith<Ctx> {
    type Output;

    // Required method
    fn run_with(self, ctx: Ctx) -> Self::Output;
}
Expand description

A command that is handed something shared when it runs.

Ctx is whatever the CLI has to give: &Config, &mut App, an owned handle. It is a parameter of the trait rather than of the method so that one command may be runnable with several — a leaf that needs only a config can implement RunWith<&Config> while its siblings implement RunWith<&mut App>, as long as the enum dispatching them agrees on one.

Required Associated Types§

Source

type Output

What running the command produces.

Required Methods§

Source

fn run_with(self, ctx: Ctx) -> Self::Output

Carry out the command, with ctx.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§