Skip to main content

ThreadActor

Struct ThreadActor 

Source
pub struct ThreadActor {}
Available on crate feature std only.
Expand description

An std::Thread based actor.

Implementations§

Source§

impl ThreadActor

Source

pub fn spawn<ST>(state: ST) -> JoinHandle<()>
where ST: ActorState + Send + 'static,

Spawn a new actor with the provided state.

Source

pub fn spawn_and_build_state<ST, STB>(state_builder: STB) -> JoinHandle<()>
where ST: ActorState + Send + 'static, STB: ActorStateBuilder<ST> + Send + 'static,

Spawn a new actor and construct its state with the provided state builder in its thread.

Source

pub fn spawn_catch_unwind<ST, F>(state: ST, err_fn: &Arc<F>) -> JoinHandle<()>
where ST: ActorState + Send + UnwindSafe + 'static, F: Fn(Box<dyn Any + Send>) + Send + Sync + 'static,

Source

pub fn spawn_build_state_and_catch_unwind<ST, STB, F>( state_builder: STB, err_fn: &Arc<F>, ) -> JoinHandle<()>
where ST: ActorState + Send + 'static, STB: ActorStateBuilder<ST> + Send + UnwindSafe + 'static, F: Fn(Box<dyn Any + Send>) + Send + Sync + 'static,

Source

pub fn build_spawn<ST>(builder: Builder, state: ST) -> Result<JoinHandle<()>>
where ST: ActorState + Send + 'static,

Source

pub fn build_spawn_and_build_state<ST, STB>( builder: Builder, state_builder: STB, ) -> Result<JoinHandle<()>>
where ST: ActorState + Send + 'static, STB: ActorStateBuilder<ST> + Send + 'static,

Source

pub fn build_spawn_and_catch_unwind<ST, F>( builder: Builder, state: ST, err_fn: &Arc<F>, ) -> Result<JoinHandle<()>>
where ST: ActorState + Send + UnwindSafe + 'static, F: Fn(Box<dyn Any + Send>) + Send + Sync + 'static,

Source

pub fn build_spawn_build_state_and_catch_unwind<ST, STB, F>( builder: Builder, state_builder: STB, err_fn: &Arc<F>, ) -> Result<JoinHandle<()>>
where ST: ActorState + Send + 'static, STB: ActorStateBuilder<ST> + Send + UnwindSafe + 'static, F: Fn(Box<dyn Any + Send>) + Send + Sync + 'static,

Source

pub fn run<ST>(state: ST)
where ST: ActorState + Send + 'static,

Auto Trait Implementations§

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

Source§

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

Source§

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.