Skip to main content

Fold

Trait Fold 

Source
pub trait Fold<Op: Operation> {
    // Required methods
    fn absorb(&mut self, event: &Op::Event) -> Result<(), ProviderError>;
    fn finish(
        self,
        end: Op::End,
        reply: Reply,
    ) -> Result<Op::Response, ProviderError>;
}
Expand description

One reply’s state for an operation.

Each event is absorbed as the consumer takes it, so the fold never runs ahead of what was delivered. The reply’s end is what finish needs: without the provider’s end there is no response.

Required Methods§

Source

fn absorb(&mut self, event: &Op::Event) -> Result<(), ProviderError>

Absorb one event the consumer is about to see. An error fails the reply.

Source

fn finish( self, end: Op::End, reply: Reply, ) -> Result<Op::Response, ProviderError>

The response, from the events absorbed, the provider’s end and what the driver learned about the reply.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Fold<Completion> for Turn

Source§

impl Fold<ContextCache> for CachedContentFold

Source§

impl<Op> Fold<Op> for Whole<Op>
where Op: Operation<Event = Infallible>, Op::End: Into<Op::Response>,