pub struct RuntimeCommandSpec {
pub spec: CommandSpec,
pub handler: CommandHandler,
}Expand description
Executable leaf command.
RuntimeCommandSpec pairs a CommandSpec with async business logic.
This split keeps metadata inspectable for help/search/schema generation
before the handler ever runs.
Fields§
§spec: CommandSpecDeclarative command metadata.
handler: CommandHandlerAsync command implementation.
Implementations§
Source§impl RuntimeCommandSpec
impl RuntimeCommandSpec
Sourcepub fn new<F, Fut, Output>(spec: CommandSpec, handler: F) -> Self
pub fn new<F, Fut, Output>(spec: CommandSpec, handler: F) -> Self
Creates a runtime command with the common handler shape.
The handler receives the optional credential and effective args. It
returns CommandResult, where data must be JSON-serializable.
Sourcepub fn new_with_context<F, Fut, Output>(spec: CommandSpec, handler: F) -> Selfwhere
F: Fn(CommandContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Output>> + Send + 'static,
Output: Into<CommandResult> + Send + 'static,
pub fn new_with_context<F, Fut, Output>(spec: CommandSpec, handler: F) -> Selfwhere
F: Fn(CommandContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Output>> + Send + 'static,
Output: Into<CommandResult> + Send + 'static,
Creates a runtime command with the full invocation context.
Trait Implementations§
Source§impl Clone for RuntimeCommandSpec
impl Clone for RuntimeCommandSpec
Source§fn clone(&self) -> RuntimeCommandSpec
fn clone(&self) -> RuntimeCommandSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RuntimeCommandSpec
impl !RefUnwindSafe for RuntimeCommandSpec
impl Send for RuntimeCommandSpec
impl Sync for RuntimeCommandSpec
impl Unpin for RuntimeCommandSpec
impl UnsafeUnpin for RuntimeCommandSpec
impl !UnwindSafe for RuntimeCommandSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more