pub struct MapEffectLayer<Next, Effect>where
Next: Layer,
Effect: 'static,{ /* private fields */ }Expand description
Middleware for converting the effect type to another type.
Typically, this is used to eliminate some of the effect variants which are processed by the layers below, so that code using this stack is not forced to have extraneous match arms which are never called.
Implementations§
Trait Implementations§
Source§impl<Next, Effect> Layer for MapEffectLayer<Next, Effect>
impl<Next, Effect> Layer for MapEffectLayer<Next, Effect>
Source§fn update<F>(&self, event: Self::Event, effect_callback: F) -> Vec<Self::Effect>
fn update<F>(&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>(
&self,
request: &mut impl Resolvable<Output>,
output: Output,
effect_callback: F,
) -> Result<Vec<Self::Effect>, ResolveError>
fn resolve<Output, F>( &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, Effect> Freeze for MapEffectLayer<Next, Effect>where
Next: Freeze,
impl<Next, Effect> RefUnwindSafe for MapEffectLayer<Next, Effect>where
Next: RefUnwindSafe,
impl<Next, Effect> Send for MapEffectLayer<Next, Effect>
impl<Next, Effect> Sync for MapEffectLayer<Next, Effect>
impl<Next, Effect> Unpin for MapEffectLayer<Next, Effect>where
Next: Unpin,
impl<Next, Effect> UnsafeUnpin for MapEffectLayer<Next, Effect>where
Next: UnsafeUnpin,
impl<Next, Effect> UnwindSafe for MapEffectLayer<Next, Effect>where
Next: UnwindSafe,
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