Struct romeo::system::System [−][src]
pub struct System { /* fields omitted */ }
System is the main handle into a running actor system. It is responsible for creating actors, starting the system (spawning threads and schedulers), stopping the system, etc.
To configure the system, please refer to romeo::system::Config
.
Methods
impl System
[src]
impl System
pub fn new() -> Self
[src]
pub fn new() -> Self
pub fn with_config(&mut self, config: Config)
[src]
pub fn with_config(&mut self, config: Config)
pub fn new_actor<A, P>(&mut self, props: P) -> Address<A> where
A: Actor + ActorConstructable<P> + 'static,
P: Props + 'static,
[src]
pub fn new_actor<A, P>(&mut self, props: P) -> Address<A> where
A: Actor + ActorConstructable<P> + 'static,
P: Props + 'static,
Create a new actor in the system and in return get an address to talk to the actor. Note that Romeo tries it's best to keep the actor away from you. Why? Because this ensures that you are not able to manipulate the internal state of the actor directly, but must communicate with it through pure semantics.
Could you manually pass in a channel to your actor instance to bypasss actor-based
communication? Sure you could, but then why are you using actors? :-P
.
Note: You the system must be running (see spawn
) before you can create actors.
pub fn spawn(&mut self)
[src]
pub fn spawn(&mut self)
Spawns threads and creates schedulers (the runtime) in order to operate the actor system
on top of. Before calling this method, ensure all desired configurations have been made
via System::with_config
. This method will not block the current thread.
pub fn graceful_shutdown(self)
[src]
pub fn graceful_shutdown(self)
Note: This currently does nothing but block on the scheduler threads, which will never exit. This is to-be-implemented.
Trait Implementations
impl Send for System
[src]
impl Send for System
As the system is more of a handle to the actor runtime, it should be able to be sent across
threads. However, it is not sync to avoid race-conditions in starting/stopping and actor creation,
as there is an assumed order. Please look into other primitives, such as a Mutex
if you require
this behavior.