pub struct ComponentRegistrar<'engine, 'a, S: EngineSpec> { /* private fields */ }Expand description
Provides component context against which a step can be registered.
Implementations§
Source§impl<'engine, 'a, S: EngineSpec> ComponentRegistrar<'engine, 'a, S>
impl<'engine, 'a, S: EngineSpec> ComponentRegistrar<'engine, 'a, S>
Sourcepub fn new_step<F, Fut, T>(
&self,
id: S::StepId,
description: impl Into<Cow<'static, str>>,
step_fn: F,
) -> NewStep<'engine, '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,
id: S::StepId,
description: impl Into<Cow<'static, str>>,
step_fn: F,
) -> NewStep<'engine, '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 component associated with the registrar.
§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.)
Auto Trait Implementations§
impl<'engine, 'a, S> Freeze for ComponentRegistrar<'engine, 'a, S>
impl<'engine, 'a, S> RefUnwindSafe for ComponentRegistrar<'engine, 'a, S>
impl<'engine, 'a, S> Send for ComponentRegistrar<'engine, 'a, S>
impl<'engine, 'a, S> Sync for ComponentRegistrar<'engine, 'a, S>
impl<'engine, 'a, S> Unpin for ComponentRegistrar<'engine, 'a, S>
impl<'engine, 'a, S> UnsafeUnpin for ComponentRegistrar<'engine, 'a, S>
impl<'engine, 'a, S> UnwindSafe for ComponentRegistrar<'engine, 'a, S>
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