pub struct ThreadActor {}Available on crate feature
std only.Expand description
An std::Thread based actor.
Implementations§
Source§impl ThreadActor
impl ThreadActor
Sourcepub fn spawn<ST>(state: ST) -> JoinHandle<()>where
ST: ActorState + Send + 'static,
pub fn spawn<ST>(state: ST) -> JoinHandle<()>where
ST: ActorState + Send + 'static,
Spawn a new actor with the provided state.
Sourcepub fn spawn_and_build_state<ST, STB>(state_builder: STB) -> JoinHandle<()>
pub fn spawn_and_build_state<ST, STB>(state_builder: STB) -> JoinHandle<()>
Spawn a new actor and construct its state with the provided state builder in its thread.
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,
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,
pub fn build_spawn<ST>(builder: Builder, state: ST) -> Result<JoinHandle<()>>where
ST: ActorState + Send + 'static,
pub fn build_spawn_and_build_state<ST, STB>( builder: Builder, state_builder: STB, ) -> Result<JoinHandle<()>>
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,
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,
pub fn run<ST>(state: ST)where
ST: ActorState + Send + 'static,
Auto Trait Implementations§
impl Freeze for ThreadActor
impl RefUnwindSafe for ThreadActor
impl Send for ThreadActor
impl Sync for ThreadActor
impl Unpin for ThreadActor
impl UnsafeUnpin for ThreadActor
impl UnwindSafe for ThreadActor
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