[]Struct actix::Arbiter

pub struct Arbiter(_);

Arbiters provide an asynchronous execution environment for actors, functions and futures. When an Arbiter is created, they spawn a new OS thread, and host an event loop. Some Arbiter functions execute on the current thread.

Methods

impl Arbiter

pub fn current() -> Arbiter

Returns the current thread's arbiter's address. If no Arbiter is present, then this function will panic!

pub fn stop(&self)

Stop arbiter from continuing it's event loop.

pub fn new() -> Arbiter

Spawn new thread and run event loop in spawned thread. Returns address of newly created arbiter.

pub fn spawn<F>(future: F) where
    F: Future<Item = (), Error = ()> + 'static, 

Spawn a future on the current thread. This does not create a new Arbiter or Arbiter address, it is simply a helper for spawning futures on the current thread.

pub fn spawn_fn<F, R>(f: F) where
    F: FnOnce() -> R + 'static,
    R: IntoFuture<Item = (), Error = ()> + 'static, 

Executes a future on the current thread. This does not create a new Arbiter or Arbiter address, it is simply a helper for executing futures on the current thread.

pub fn send<F>(&self, future: F) where
    F: Future<Item = (), Error = ()> + Send + 'static, 

Send a future to the Arbiter's thread, and spawn it.

pub fn exec_fn<F>(&self, f: F) where
    F: FnOnce() + Send + 'static, 

Send a function to the Arbiter's thread, and execute it. Any result from the function is discarded.

pub fn exec<F, R>(&self, f: F) -> impl Future<Item = R, Error = Canceled> where
    F: FnOnce() -> R + Send + 'static,
    R: Send + 'static, 

Send a function to the Arbiter's thread. This function will be executed asynchronously. A future is created, and when resolved will contain the result of the function sent to the Arbiters thread.

Trait Implementations

impl Default for Arbiter

impl Debug for Arbiter

impl Clone for Arbiter

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Arbiter

impl Sync for Arbiter

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T