pub struct HandleEffectLayer<Next, EM>where
Next: Layer + Sync + Send + 'static,
Next::Effect: TryInto<Request<EM::Op>, Error = Next::Effect>,
EM: EffectMiddleware,{ /* private fields */ }Expand description
Middleware layer able to process some of the effects. This implements the
general behaviour making sure all follow-up effects are processed and routed
to the right place and delegates to the generic parameter EM, which
implements EffectMiddleware.
Implementations§
Source§impl<Next, EM> HandleEffectLayer<Next, EM>
impl<Next, EM> HandleEffectLayer<Next, EM>
Sourcepub fn new(next: Next, middleware: EM) -> Self
pub fn new(next: Next, middleware: EM) -> Self
Typically, you would use Layer::handle_effects_using to construct a
HandleEffectLayer instance for a specific EffectMiddleware.
Trait Implementations§
Source§impl<Next, EM> Layer for HandleEffectLayer<Next, EM>
impl<Next, EM> Layer for HandleEffectLayer<Next, EM>
Source§fn update<F: Fn(Vec<Self::Effect>) + Send + Sync + 'static>(
&self,
event: Self::Event,
effect_callback: F,
) -> Vec<Self::Effect>
fn update<F: Fn(Vec<Self::Effect>) + Send + Sync + 'static>( &self, event: Self::Event, effect_callback: F, ) -> Vec<Self::Effect>
Process event from the Shell. Compared to
Core::process_event this expects an
additional argument - a callback to be called with effects requested outside of the
initial call context. Read moreSource§fn resolve<Output, F: Fn(Vec<Self::Effect>) + Send + Sync + 'static>(
&self,
request: &mut impl Resolvable<Output>,
output: Output,
effect_callback: F,
) -> Result<Vec<Self::Effect>, ResolveError>
fn resolve<Output, F: Fn(Vec<Self::Effect>) + Send + Sync + 'static>( &self, request: &mut impl Resolvable<Output>, output: Output, effect_callback: F, ) -> Result<Vec<Self::Effect>, ResolveError>
Resolve a requested effect. Compared to
Core::process_event this expects an
additional argument - a callback to be called with effects requested outside of the
initial call context. Read moreSource§fn process_tasks<F>(&self, effect_callback: F) -> Vec<Self::Effect>
fn process_tasks<F>(&self, effect_callback: F) -> Vec<Self::Effect>
Process any tasks in the effect runtime of the Core, which are able to proceed.
The tasks may produce effects which will be returned by the core and may be
processed by lower middleware layers. Read more
Source§fn handle_effects_using<EM>(self, middleware: EM) -> HandleEffectLayer<Self, EM>
fn handle_effects_using<EM>(self, middleware: EM) -> HandleEffectLayer<Self, EM>
Wrap this layer with an effect handling middleware. The
middleware argument
must implement the EffectMiddleware trait.Source§fn map_effect<NewEffect>(self) -> MapEffectLayer<Self, NewEffect>
fn map_effect<NewEffect>(self) -> MapEffectLayer<Self, NewEffect>
Wrap this layer with an effect mapping middleware to change the
Effect type returned. Read more
fn bridge<Format: FfiFormat>( self, effect_callback: impl Fn(Result<Vec<u8>, BridgeError<Format>>) + Send + Sync + 'static, ) -> Bridge<Self, Format>
Auto Trait Implementations§
impl<Next, EM> Freeze for HandleEffectLayer<Next, EM>
impl<Next, EM> RefUnwindSafe for HandleEffectLayer<Next, EM>
impl<Next, EM> Send for HandleEffectLayer<Next, EM>
impl<Next, EM> Sync for HandleEffectLayer<Next, EM>
impl<Next, EM> Unpin for HandleEffectLayer<Next, EM>
impl<Next, EM> UnsafeUnpin for HandleEffectLayer<Next, EM>
impl<Next, EM> UnwindSafe for HandleEffectLayer<Next, EM>
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