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
impl Hell
Sourcepub fn new() -> Hell
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!Sourcepub fn builder() -> HellBuilder
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!Sourcepub async fn ignite(self) -> Result<(Gate, JoinHandle<()>), Error>
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 Freeze for Hell
impl RefUnwindSafe for Hell
impl Send for Hell
impl Sync for Hell
impl Unpin for Hell
impl UnsafeUnpin for Hell
impl UnwindSafe for Hell
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