[][src]Crate xtra

xtra is a tiny, fast, and safe actor system.

Re-exports

pub use self::address::Address;
pub use self::address::Disconnected;
pub use self::address::WeakAddress;

Modules

address

An address to an actor is a way to send it a message. An address allows an actor to be sent any kind of message that it can receive.

message_channel

A message channel is a channel through which you can send only one kind of message, but to any actor that can handle it. It is like Address, but associated with the message type rather than the actor type.

prelude

Commonly used types from xtra

refcount

This module contains types representing the strength of an address's reference counting, which influences whether the address will keep the actor alive for as long as it lives.

sink

Module for the sink equivalents to Address and MessageChannel.

spawn

This module contains a trait to spawn actors, implemented for all major async runtimes by default.

Structs

ActorManager

A manager for the actor which handles incoming messages and stores the context. Its managing loop can be started with ActorManager::run.

ActorShutdown

The operation failed because the actor is being shut down

Context

Context is used to control how the actor is managed and to get the actor's address from inside of a message handler.

Enums

KeepRunning

Whether to keep the actor running after it has been put into a stopping state.

Traits

Actor

An actor which can handle Messages one at a time. Actors can only be communicated with by sending Messages through their Addresses. They can modify their private state, respond to messages, and spawn other actors. They can also stop themselves through their Context by calling Context::stop. This will result in any attempt to send messages to the actor in future failing.

Handler

A trait indicating that an Actor can handle a given Message asynchronously, and the logic to handle the message.

Message

A message that can be sent to an Actor for processing. They are processed one at a time. Only actors implementing the corresponding Handler<M> trait can be sent a given message.