Module messaging

Source

Structs§

LateBoundSender
Sometimes we want to be able to pass in a sender that has not yet been fully constructed. LateBoundSender can act as a placeholder to pass CanSend and CanSendAsync capabilities through to the inner object. bind() should be called when the inner object is ready. All calls to send() and send_async() through this wrapper will block until bind() is called.
MessageWithCallback
Used to implement an async sender. An async sender is just a Sender whose message is MessageWithCallback<M, R>, which is a message plus a callback to send the response future back.
Noop
Sender
Wraps a CanSend. This should be used to pass around an Arc<dyn CanSend>, instead of spelling out that type. Using a wrapper struct allows us to define more flexible APIs.

Enums§

AsyncSendError
Generic failure for async send.

Traits§

Actor
Trait for an actor. An actor is a struct that can handle messages and implements the Handler or HandlerWithContext trait. We can optionally implement the start_actor trait which is executed in the beginning of the actor’s lifecycle. This corresponds to the actix::Actor trait started function.
CanSend
Trait for sending a typed message. The sent message is then handled by the Handler trait. actix::Addr, which is derived from actix::Actor is an example of a struct that implements CanSend. See Handler trait for more details.
Handler
Trait for handling a message. This works in unison with the CanSend trait. An actor implements the Handler trait for all messages it would like to handle, while the CanSend trait implements the logic to send the message to the actor. Handle and CanSend are typically not both implemented by the same struct. Note that the actor is any struct that implements the Handler trait, not just actix actors.
HandlerWithContext
Trait for handling a message with context. This is similar to the Handler trait, but it allows the handler to access the delayed action runner that is used to schedule actions to be run in the future. For actix::Actor, the context defined as actix::Context implements DelayedActionRunner. Note that the implementer for handler of a message only needs to implement either of Handler or HandlerWithContext, not both.
IntoMultiSender
A trait for converting something that implements individual senders into a multi-sender.
IntoSender
Extension functions to wrap a CanSend as a Sender.
MultiSenderFrom
SendAsync
Extension trait (not for anyone to implement), that allows a Sender<MessageWithCallback<M, R>> to be used to send a message and then getting a future of the response.

Functions§

noop
Creates a no-op sender that does nothing with the message.

Type Aliases§

AsyncSender