[−][src]Struct acteur::Acteur
Acteur is the main inteface to the actor runtime. It allows sending messages, stopping the runtime, set configurations, etc. Once contructed with the method "new" you can start sending messages. The system will automatically start any required actor and unload them when not used.
Implementations
impl Acteur
[src]
pub fn new() -> Acteur
[src]
Initializes the system. After this, you can send messages using the send method.
pub async fn send_to_actor<A: Actor + Receive<M>, M: Debug + Send + 'static, '_>(
&'_ self,
actor_id: A::Id,
message: M
)
[src]
&'_ self,
actor_id: A::Id,
message: M
)
Sends a message to an actor with an ID.
This method will execute the Receive::handle implemented for that Message and Actor.
If the actor is not loaded in Ram, this method will load them first by calling their "activate" method.
pub fn send_to_actor_sync<A: Actor + Receive<M>, M: Debug + Send + 'static>(
&self,
actor_id: A::Id,
message: M
)
[src]
&self,
actor_id: A::Id,
message: M
)
Same as send_to_actor
method, but sync version.
pub async fn schedule_send_to_actor<A: Actor + Receive<M>, M: Debug + Send + 'static, '_>(
&'_ self,
actor_id: A::Id,
duration: Duration,
message: M
)
[src]
&'_ self,
actor_id: A::Id,
duration: Duration,
message: M
)
Same as send_to_actor
but it delays the message sending
pub fn schedule_send_to_actor_sync<A: Actor + Receive<M>, M: Debug + Send + 'static>(
&self,
actor_id: A::Id,
duration: Duration,
message: M
)
[src]
&self,
actor_id: A::Id,
duration: Duration,
message: M
)
Same as schedule_send_to_actor
method, but sync version.
pub async fn send_to_all_actors<A: Actor + Receive<M>, M: Debug + Send + 'static, '_>(
&'_ self,
message: M
)
[src]
&'_ self,
message: M
)
Sends a message to all actors of a type independently of their ID
This method will execute the Receive::handle implemented for that Message and Actor.
This method will only affect to actors already loaded in Ram
pub async fn send_to_all_actors_sync<A: Actor + Receive<M>, M: Debug + Send + 'static, '_>(
&'_ self,
message: M
)
[src]
&'_ self,
message: M
)
Same as send_to_all_actors
method, but sync version.
pub async fn schedule_send_to_all_actors<A: Actor + Receive<M>, M: Debug + Send + 'static, '_>(
&'_ self,
duration: Duration,
message: M
)
[src]
&'_ self,
duration: Duration,
message: M
)
Same as send_to_all_actors
but it delays the message sending
pub async fn schedule_send_to_all_actors_sync<A: Actor + Receive<M>, M: Debug + Send + 'static, '_>(
&'_ self,
duration: Duration,
message: M
)
[src]
&'_ self,
duration: Duration,
message: M
)
Same as schedule_send_to_all_actors
method, but sync version.
pub async fn call_actor<A: Actor + Respond<M>, M: Debug + Send + 'static, '_, '_>(
&'_ self,
actor_id: A::Id,
message: M
) -> Result<<A as Respond<M>>::Response, &'_ str>
[src]
&'_ self,
actor_id: A::Id,
message: M
) -> Result<<A as Respond<M>>::Response, &'_ str>
As send_to_actor method, it sends a message to an actor with an ID but this one wait for a response from the actor.
This method will execute the Respond::handle implemented for that Message and Actor.
If the actor is not loaded in Ram, this method will load them first by calling their "activate" method.
pub fn call_actor_sync<A: Actor + Respond<M>, M: Debug + Send + 'static>(
&self,
actor_id: A::Id,
message: M
) -> Result<<A as Respond<M>>::Response, &str>
[src]
&self,
actor_id: A::Id,
message: M
) -> Result<<A as Respond<M>>::Response, &str>
Same as call_actor
method, but sync version.
pub async fn send_to_service<S: Service + Listen<M>, M: Debug + Send + 'static, '_>(
&'_ self,
message: M
)
[src]
&'_ self,
message: M
)
Sends a message to a Service.
This method will execute the Listen::handle implemented for that Message and Service.
If the Service is not loaded in Ram, this method will load them first by calling their "initialize" method.
pub fn send_to_service_sync<S: Service + Listen<M>, M: Debug + Send + 'static>(
&self,
message: M
)
[src]
&self,
message: M
)
Same as send_to_service
method, but sync version.
pub async fn call_service<S: Service + Serve<M>, M: Debug + Send + 'static, '_, '_>(
&'_ self,
message: M
) -> Result<<S as Serve<M>>::Response, &'_ str>
[src]
&'_ self,
message: M
) -> Result<<S as Serve<M>>::Response, &'_ str>
As send_to_service method, it sends a message to a Service but this one wait for a response from the actor.
This method will execute the Serve::handle implemented for that Message and Service.
If the Service is not loaded in Ram, this method will load them first by calling their "initialize" method.
pub fn call_service_sync<S: Service + Serve<M>, M: Debug + Send + 'static>(
&self,
message: M
) -> Result<<S as Serve<M>>::Response, &str>
[src]
&self,
message: M
) -> Result<<S as Serve<M>>::Response, &str>
Same as call_service
method, but sync version.
pub fn stop(&self)
[src]
Send an stop message to all actors in the system. Actors will process all the enqued messages before stop
pub async fn preload_service<S: Service, '_>(&'_ self)
[src]
Ensures a service is loaded and running. It ensures that all Service's subscriptions are performed
pub fn preload_service_sync<S: Service>(&self)
[src]
Same as preload_service
but sync version
pub fn wait_until_stopped(&self)
[src]
Waits until all actors are stopped. If you call "system.stop()" this method will wait untill all actor have consumed all messages before returning.
pub fn get_statistics(&self) -> Vec<(TypeId, Vec<ActorReport>)>
[src]
pub async fn publish<M: Send + Clone + 'static, '_>(&'_ mut self, message: M)
[src]
Allows to publish messages for Services to receive. In order for the mesage to be received by a service, the service must register itself for that message type.
pub fn publish_sync<M: Send + Clone + 'static>(&mut self, message: M)
[src]
Same as publish method, but sync version
Trait Implementations
impl Clone for Acteur
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Acteur
[src]
impl Default for Acteur
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Acteur
impl Send for Acteur
impl Sync for Acteur
impl Unpin for Acteur
impl !UnwindSafe for Acteur
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,