pub trait CliTool<T: Serialize + Send>:
Sized
+ Send
+ Parser {
// Required method
fn execute<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided methods
fn execute_serialized<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = UserResult> + Send + 'async_trait>>
where Self: 'async_trait { ... }
fn execute_serialized_success<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = UserResult> + Send + 'async_trait>>
where Self: 'async_trait { ... }
fn execute_main<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait { ... }
}
Expand description
A common trait for all CLI commands to have consistent outputs
Required Methods§
Provided Methods§
Sourcefn execute_serialized<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = UserResult> + Send + 'async_trait>>where
Self: 'async_trait,
fn execute_serialized<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = UserResult> + Send + 'async_trait>>where
Self: 'async_trait,
Executes the command, and serializes it to the common JSON output type
Sourcefn execute_serialized_success<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = UserResult> + Send + 'async_trait>>where
Self: 'async_trait,
fn execute_serialized_success<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = UserResult> + Send + 'async_trait>>where
Self: 'async_trait,
Executes the command, and throws away Ok(result) for the string Success
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.