Struct heph_rt::access::ThreadLocal
source · [−]pub struct ThreadLocal { /* private fields */ }Expand description
Provides access to the thread-local runtime.
This implements the Access trait, which is required by various APIs to
get access to the runtime. Furthermore this gives access to a
RuntimeRef for users.
This is usually a part of the actor::Context, see it for more
information.
This is an optimised version of ThreadSafe, but doesn’t allow the actor
to move between threads.
Methods from Deref<Target = RuntimeRef>
sourcepub fn try_spawn_local<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> Result<ActorRef<NA::Message>, NA::Error>where
S: Supervisor<NA> + 'static,
NA: NewActor<RuntimeAccess = ThreadLocal> + 'static,
NA::Actor: 'static,
pub fn try_spawn_local<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> Result<ActorRef<NA::Message>, NA::Error>where
S: Supervisor<NA> + 'static,
NA: NewActor<RuntimeAccess = ThreadLocal> + 'static,
NA::Actor: 'static,
Attempt to spawn a new thread-local actor.
See the Spawn trait for more information.
sourcepub fn spawn_local<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> ActorRef<NA::Message>where
S: Supervisor<NA> + 'static,
NA: NewActor<Error = !, RuntimeAccess = ThreadLocal> + 'static,
NA::Actor: 'static,
pub fn spawn_local<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> ActorRef<NA::Message>where
S: Supervisor<NA> + 'static,
NA: NewActor<Error = !, RuntimeAccess = ThreadLocal> + 'static,
NA::Actor: 'static,
Spawn a new thread-local actor.
See the Spawn trait for more information.
sourcepub fn try_spawn<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> Result<ActorRef<NA::Message>, NA::Error>where
S: Supervisor<NA> + Send + Sync + 'static,
NA: NewActor<RuntimeAccess = ThreadSafe> + Sync + Send + 'static,
NA::Actor: Send + Sync + 'static,
NA::Message: Send,
pub fn try_spawn<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> Result<ActorRef<NA::Message>, NA::Error>where
S: Supervisor<NA> + Send + Sync + 'static,
NA: NewActor<RuntimeAccess = ThreadSafe> + Sync + Send + 'static,
NA::Actor: Send + Sync + 'static,
NA::Message: Send,
Attempt to spawn a new thread-safe actor.
See the Spawn trait for more information.
sourcepub fn spawn<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> ActorRef<NA::Message>where
S: Supervisor<NA> + Send + Sync + 'static,
NA: NewActor<Error = !, RuntimeAccess = ThreadSafe> + Sync + Send + 'static,
NA::Actor: Send + Sync + 'static,
NA::Message: Send,
pub fn spawn<S, NA>(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> ActorRef<NA::Message>where
S: Supervisor<NA> + Send + Sync + 'static,
NA: NewActor<Error = !, RuntimeAccess = ThreadSafe> + Sync + Send + 'static,
NA::Actor: Send + Sync + 'static,
NA::Message: Send,
Spawn a new thread-safe actor.
See the Spawn trait for more information.
sourcepub fn spawn_local_future<Fut>(&mut self, future: Fut, options: FutureOptions)where
Fut: Future<Output = ()> + 'static,
pub fn spawn_local_future<Fut>(&mut self, future: Fut, options: FutureOptions)where
Fut: Future<Output = ()> + 'static,
sourcepub fn spawn_future<Fut>(&mut self, future: Fut, options: FutureOptions)where
Fut: Future<Output = ()> + Send + Sync + 'static,
pub fn spawn_future<Fut>(&mut self, future: Fut, options: FutureOptions)where
Fut: Future<Output = ()> + Send + Sync + 'static,
sourcepub fn receive_signals(&mut self, actor_ref: ActorRef<Signal>)
pub fn receive_signals(&mut self, actor_ref: ActorRef<Signal>)
Receive process signals as messages.
This adds the actor_ref to the list of actor references that will
receive a process signal.
Trait Implementations
sourceimpl Clone for ThreadLocal
impl Clone for ThreadLocal
sourcefn clone(&self) -> ThreadLocal
fn clone(&self) -> ThreadLocal
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more