pub struct UpdateEngine<'a, S: EngineSpec> { /* private fields */ }Implementations§
Source§impl<'a, S: EngineSpec + 'a> UpdateEngine<'a, S>
impl<'a, S: EngineSpec + 'a> UpdateEngine<'a, S>
Sourcepub fn new(log: &Logger, sender: Sender<Event<S>>) -> Self
pub fn new(log: &Logger, sender: Sender<Event<S>>) -> Self
Creates a new UpdateEngine.
It is recommended that sender be created using the channel
function, which sets an appropriate channel size.
Sourcepub fn execution_id(&self) -> ExecutionUuid
pub fn execution_id(&self) -> ExecutionUuid
Returns the ID for this execution.
All events coming from this engine will have this ID associated with them.
Sourcepub fn new_step<F, Fut, T>(
&self,
component: S::Component,
id: S::StepId,
description: impl Into<Cow<'static, str>>,
step_fn: F,
) -> NewStep<'_, 'a, S, T>where
F: FnOnce(StepContext<S>) -> Fut + Send + 'a,
Fut: Future<Output = Result<StepResult<T, S>, S::Error>> + Send + 'a,
T: Send + 'a,
pub fn new_step<F, Fut, T>(
&self,
component: S::Component,
id: S::StepId,
description: impl Into<Cow<'static, str>>,
step_fn: F,
) -> NewStep<'_, 'a, S, T>where
F: FnOnce(StepContext<S>) -> Fut + Send + 'a,
Fut: Future<Output = Result<StepResult<T, S>, S::Error>> + Send + 'a,
T: Send + 'a,
Adds a new step corresponding to the given component.
§Notes
The step will be considered to keep running until both the future
completes and the StepContext is dropped. In normal use, both
happen at the same time. However, it is technically possible to
make the StepContext escape the future.
(Ideally, this would be prevented by making the function take a
&mut StepContext, but there are limitations in stable Rust
which make this impossible to achieve.)
Sourcepub fn for_component(
&self,
component: S::Component,
) -> ComponentRegistrar<'_, 'a, S>
pub fn for_component( &self, component: S::Component, ) -> ComponentRegistrar<'_, 'a, S>
Creates a ComponentRegistrar that defines steps within the
context of a component.
It is often useful to define similar steps across multiple
components. A ComponentRegistrar provides an easy way to do
so.
Sourcepub fn abort_handle(&self) -> AbortHandle
pub fn abort_handle(&self) -> AbortHandle
Creates and returns an abort handle for this engine.
An abort handle can be used to forcibly cancel update engine executions.
Sourcepub fn execute(self) -> ExecutionHandle<'a, S> ⓘ
pub fn execute(self) -> ExecutionHandle<'a, S> ⓘ
Executes the engine.
This returns an ExecutionHandle, which needs to be awaited on
to drive the engine forward.