pub trait Action<Context>:
Describe
+ Clone
+ Copy
+ Eq {
type Error;
// Required method
fn run(&self, _ctx: &mut Context) -> Result<(), Self::Error>;
// Provided methods
fn select() -> Result<Self, Error> { ... }
fn select_with_prompt<S>(prompt: S) -> Result<Self, Error>
where S: Display { ... }
fn multiselect<S>(values: Vec<Self>) -> Result<Vec<Self>, Error> { ... }
fn multiselect_with_prompt<S>(
prompt: S,
values: Vec<Self>,
) -> Result<Vec<Self>, Error>
where S: Display { ... }
}Expand description
An enumerable command that can be presented to the user as an interactive
CLI selection and then executed against a shared Context.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn select() -> Result<Self, Error>
fn select() -> Result<Self, Error>
Prompts the user to pick a single action using the type’s default caption.
Sourcefn select_with_prompt<S>(prompt: S) -> Result<Self, Error>where
S: Display,
fn select_with_prompt<S>(prompt: S) -> Result<Self, Error>where
S: Display,
Prompts the user to pick a single action using the supplied prompt text.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".