[][src]Crate xtra_addons

Structs

Address

An Address is a reference to an actor through which Messages can be sent. It can be cloned to create more addresses to the same actor. By default (i.e without specifying the second type parameter, Rc, to be weak), Addresses are strong. Therefore, when all Addresses are dropped, the actor will be stopped. In other words, any existing Addresses will inhibit the dropping of an actor. If this is undesirable, then a WeakAddress should be used instead. An address is created by calling the Actor::create or Context::run methods, or by cloning another Address.

Broker
Context

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

Registry
Subscription

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.

FromRegistryExt
FromRegistryExtOpt
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.

MessageChannel

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. This trait represents any kind of message channel. There are two traits which inherit from it - one for weak message channels, and one for strong message channels. Both of these traits may be downcasted to this trait using their respective downcast methods. Therefore, this trait is most useful when you want to be generic over both strong and weak message channels. If this is undesireable or not needed, simply use their respective trait objects instead.

PublishExt
StrongMessageChannel

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. Any existing MessageChannels will prevent the dropping of the actor. If this is undesirable, then the WeakMessageChannel struct should be used instead. A StrongMessageChannel trait object is created by casting a strong Address.

SubscribeExt
WeakMessageChannel

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. Any existing WeakMessageChannels will not prevent the dropping of the actor. If this is undesirable, then StrongMessageChannel should be used instead. A WeakMessageChannel trait object is created by calling StrongMessageChannel::downgrade or by casting a WeakAddress.