Trait ya_runtime_sdk::RunCommandExt
source · pub trait RunCommandExt<R: Runtime + ?Sized> {
type Item: 'static;
fn as_command<'a, H, Fh>(
self,
ctx: &mut Context<R>,
handler: H
) -> ProcessIdResponse<'a>
where
H: FnOnce(Self::Item, RunCommandContext) -> Fh + 'static,
Fh: Future<Output = Result<(), Error>> + 'static;
}
Expand description
Wraps command lifecycle in the following manner:
- manages command sequence numbers
- emits command start & stop events
- provides a RunCommandContext object for easier output event emission
Required Associated Types§
Required Methods§
sourcefn as_command<'a, H, Fh>(
self,
ctx: &mut Context<R>,
handler: H
) -> ProcessIdResponse<'a>where
H: FnOnce(Self::Item, RunCommandContext) -> Fh + 'static,
Fh: Future<Output = Result<(), Error>> + 'static,
fn as_command<'a, H, Fh>(
self,
ctx: &mut Context<R>,
handler: H
) -> ProcessIdResponse<'a>where
H: FnOnce(Self::Item, RunCommandContext) -> Fh + 'static,
Fh: Future<Output = Result<(), Error>> + 'static,
Wrap self
in run_command
Implementors§
source§impl<R, F, Rt, Re> RunCommandExt<R> for Fwhere
R: Runtime + ?Sized,
<R as RuntimeDef>::Cli: 'static,
F: Future<Output = Result<Rt, Re>> + 'static,
Rt: 'static,
Re: 'static,
Error: From<Re>,
impl<R, F, Rt, Re> RunCommandExt<R> for Fwhere
R: Runtime + ?Sized,
<R as RuntimeDef>::Cli: 'static,
F: Future<Output = Result<Rt, Re>> + 'static,
Rt: 'static,
Re: 'static,
Error: From<Re>,
Implements RunCommandExt
for Future
s outputting Result
s.
The output result is checked prior to emitting any command lifecycle events.