Struct heph::rt::Runtime [−][src]
pub struct Runtime { /* fields omitted */ }
Expand description
The runtime that runs all actors.
The runtime will start workers threads that will run all actors, these threads will run until all actors have returned. See the module documentation for more information.
Implementations
Setup a new Runtime
.
See Setup
for the available configuration options.
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,
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.
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,
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.
Spawn an synchronous actor that runs on its own thread.
For more information and examples of synchronous actors see the
actor
module.
pub 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,
Spawn a thread-safe Future
.
See RuntimeRef::spawn_future
for more documentation.
Run the function f
on all worker threads.
This can be used to spawn thread-local actors, e.g. TcpServer
, or to
initialise thread-local data on each worker thread ensuring that it’s
properly initialised without impacting the performance of the first
request(s).
Receive process signals as messages.
This adds the actor_ref
to the list of actor references that will
receive a process signal.
Run the runtime.
This will wait until all spawned workers have finished, which happens
when all actors have finished. In addition to waiting for all worker
threads it will also watch for all process signals in Signal
and
relay them to actors that want to handle them, see the Signal
type
for more information.
Trait Implementations
fn try_spawn(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> Result<ActorRef<NA::Message>, NA::Error> where
S: Supervisor<NA>,
NA: NewActor<RuntimeAccess = RT>,
fn try_spawn(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> Result<ActorRef<NA::Message>, NA::Error> where
S: Supervisor<NA>,
NA: NewActor<RuntimeAccess = RT>,
Attempts to spawn an actor. Read more
fn spawn(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> ActorRef<NA::Message> where
S: Supervisor<NA>,
NA: NewActor<Error = !, RuntimeAccess = RT>,
fn spawn(
&mut self,
supervisor: S,
new_actor: NA,
arg: NA::Argument,
options: ActorOptions
) -> ActorRef<NA::Message> where
S: Supervisor<NA>,
NA: NewActor<Error = !, RuntimeAccess = RT>,
Spawn an actor. Read more