Skip to main content

Environment

Trait Environment 

Source
pub trait Environment {
    type Event;
    type Effect;
    type Error;

    // Required methods
    fn next(&mut self) -> impl Future<Output = Option<Self::Event>> + Send;
    fn interpret(
        &mut self,
        effect: Self::Effect,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn retire(&mut self) -> impl Future<Output = ()> + Send;
}
Expand description

Gives a process protocol its live or simulated meaning.

Unlike narrower ingress ports, an environment also owns effect interpretation and the ordering between input and effects.

Required Associated Types§

Source

type Event

Events supplied to the behavior.

Source

type Effect

Effects emitted by the behavior in one transition.

Source

type Error

Failure while interpreting an effect.

Required Methods§

Source

fn next(&mut self) -> impl Future<Output = Option<Self::Event>> + Send

Produce the next event, or None when the source is closed.

Source

fn interpret( &mut self, effect: Self::Effect, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Interpret one successful transition’s complete effect.

Source

fn retire(&mut self) -> impl Future<Output = ()> + Send

Retire resources that must be gone before terminal publication.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§