Struct apocalypse::Hell

source ·
pub struct Hell { /* private fields */ }
Expand description

§Hell structure

This is equivalent to a normal actor framework system/runtime. A Hell instance will dispatch messages and coordinate interaction between actors.

Implementations§

source§

impl Hell

source

pub fn new() -> Hell

Creates a new hell instance with default parameters

In this case, a timeout is not set, and vanquish calls are executed until the demon gracefully shuts down

let hell = Hell::new();
// Now we can spawn demons!
source

pub fn builder() -> HellBuilder

Creates a new HellBuilder

let hell = Hell::builder().timeout(std::time::Duration::from_secs(5)).build();
// Now we can spawn demons!
source

pub async fn ignite(self) -> Result<(Gate, JoinHandle<()>), Error>

Starts the actor system

This method returns both a Gate, and a JoinHandle.

use apocalypse::{Hell};

#[tokio::main]
async fn main() {
    let hell = Hell::new();
    let (gate, join_handle) = hell.ignite().await.unwrap();
    // Do stuff with the gate
    // ...
    // Finally, await the actor's system execution
    join_handle.await.unwrap();
}

Auto Trait Implementations§

§

impl !RefUnwindSafe for Hell

§

impl Send for Hell

§

impl Sync for Hell

§

impl Unpin for Hell

§

impl !UnwindSafe for Hell

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.