Structs§
- An
Address
is a reference to an actor through whichMessage
s 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),Address
es are strong. Therefore, when allAddress
es are dropped, the actor will be stopped. In other words, any existingAddress
es will inhibit the dropping of an actor. If this is undesirable, then aWeakAddress
should be used instead. An address is created by calling theActor::create
orContext::run
methods, or by cloning anotherAddress
. - The async std runtime.
Context
is used to control how the actor is managed and to get the actor’s address from inside of a message handler.
Traits§
- An actor which can handle
Message
s one at a time. Actors can only be communicated with by sendingMessage
s through theirAddress
es. They can modify their private state, respond to messages, and spawn other actors. They can also stop themselves through theirContext
by callingContext::stop
. This will result in any attempt to send messages to the actor in future failing. - An extension trait used to allow ergonomic spawning of an actor onto the global runtime.
- A message that can be sent to an
Actor
for processing. They are processed one at a time. Only actors implementing the correspondingHandler<M>
trait can be sent a given message. - 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 respectivedowncast
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. - An
Spawner
represents anything that can spawn a future to be run in the background. This is used to spawn actors. - 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 existingMessageChannel
s will prevent the dropping of the actor. If this is undesirable, then theWeakMessageChannel
struct should be used instead. AStrongMessageChannel
trait object is created by casting a strongAddress
. - 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 existingWeakMessageChannel
s will not prevent the dropping of the actor. If this is undesirable, thenStrongMessageChannel
should be used instead. AWeakMessageChannel
trait object is created by callingStrongMessageChannel::downgrade
or by casting aWeakAddress
.