Skip to main content

Episode

Struct Episode 

Source
pub struct Episode<B: Behavior> { /* private fields */ }
Expand description

A set of actors brought into being together, wired to one another as their inits allow, and run until every one of them has stopped.

Implementations§

Source§

impl<B: Behavior> Episode<B>

Source

pub fn new(init: HashMap<ActorId, ActorInit<B>>, logger: Logger<B::Log>) -> Self

The actors described by init, wired to one another as it allows. Those with has_logger get a copy of logger.

§Panics

Panics when an init’s can_send_to or can_shut_down names an actor missing from init. An episode’s wiring is checked when it is built.

Source

pub async fn run(self, patience: Duration) -> Result<()>
where B: 'static,

Spawn every actor, wait until all of them are initialized and running their message loops, then tell each one to start, and wait for all of them to finish. Once patience runs out, shut down every actor still running and fail.

Every actor is ready before any actor starts, so an opening move always lands on an actor that is running.

§Errors

The first actor to fail shuts the others down, and its error is the episode’s. An actor that fails to initialize fails the episode before any actor starts. Running out of patience is an error too.

Auto Trait Implementations§

§

impl<B> !RefUnwindSafe for Episode<B>

§

impl<B> !UnwindSafe for Episode<B>

§

impl<B> Freeze for Episode<B>
where HashMap<String, Actor<B>>: Freeze,

§

impl<B> Send for Episode<B>
where HashMap<String, Actor<B>>: Send,

§

impl<B> Sync for Episode<B>
where HashMap<String, Actor<B>>: Sync,

§

impl<B> Unpin for Episode<B>
where HashMap<String, Actor<B>>: Unpin,

§

impl<B> UnsafeUnpin for Episode<B>
where HashMap<String, Actor<B>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.