Struct actix_rt::Arbiter[][src]

pub struct Arbiter { /* fields omitted */ }

An Arbiter represents a thread that provides an asynchronous execution environment for futures and functions.

When an arbiter is created, it spawns a new OS thread, and hosts an event loop.

Implementations

impl Arbiter[src]

pub fn new() -> Arbiter[src]

Spawn new Arbiter thread and start its event loop.

Panics

Panics if a System is not registered on the current thread.

pub fn current() -> ArbiterHandle[src]

Return a handle to the current thread's Arbiter's message sender.

Panics

Panics if no Arbiter is running on the current thread.

pub fn stop(&self) -> bool[src]

Stop Arbiter from continuing it's event loop.

Returns true if stop message was sent successfully and false if the Arbiter has been dropped.

pub fn spawn<Fut>(&self, future: Fut) -> bool where
    Fut: Future<Output = ()> + Send + 'static, 
[src]

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

If you require a result, include a response channel in the future.

Returns true if future was sent successfully and false if the Arbiter has died.

pub fn spawn_fn<F>(&self, f: F) -> bool where
    F: FnOnce() + Send + 'static, 
[src]

Send a function to the Arbiter's thread and execute it.

Any result from the function is discarded. If you require a result, include a response channel in the function.

Returns true if function was sent successfully and false if the Arbiter has died.

pub fn join(self) -> Result<()>[src]

Wait for Arbiter's event loop to complete.

Joins the underlying OS thread handle. See JoinHandle::join.

pub fn set_item<T: 'static>(item: T)[src]

👎 Deprecated:

Will be removed in stable v2.

Insert item into Arbiter's thread-local storage.

Overwrites any item of the same type previously inserted.

pub fn contains_item<T: 'static>() -> bool[src]

👎 Deprecated:

Will be removed in stable v2.

Check if Arbiter's thread-local storage contains an item type.

pub fn get_item<T: 'static, F, R>(mut f: F) -> R where
    F: FnMut(&T) -> R, 
[src]

👎 Deprecated:

Will be removed in stable v2.

Call a function with a shared reference to an item in this Arbiter's thread-local storage.

Panics

Panics if item is not in Arbiter's thread-local item storage.

pub fn get_mut_item<T: 'static, F, R>(mut f: F) -> R where
    F: FnMut(&mut T) -> R, 
[src]

👎 Deprecated:

Will be removed in stable v2.

Call a function with a mutable reference to an item in this Arbiter's thread-local storage.

Panics

Panics if item is not in Arbiter's thread-local item storage.

Trait Implementations

impl Debug for Arbiter[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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.