Struct actix_rt::Arbiter [−][src]
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]
Fut: Future<Output = ()> + Send + 'static,
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]
F: FnOnce() + Send + 'static,
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]
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]
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]
F: FnMut(&T) -> R,
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]
F: FnMut(&mut T) -> R,
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
Auto Trait Implementations
impl !RefUnwindSafe for Arbiter
[src]
impl Send for Arbiter
[src]
impl Sync for Arbiter
[src]
impl Unpin for Arbiter
[src]
impl !UnwindSafe for Arbiter
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,