Trait xtra::message_channel::StrongMessageChannel
source · [−]pub trait StrongMessageChannel<M: Message>: MessageChannel<M> {
fn downgrade(&self) -> Box<dyn WeakMessageChannel<M>>;
fn upcast(self) -> Box<dyn MessageChannel<M>>;
fn upcast_ref(&self) -> &dyn MessageChannel<M>;
fn clone_channel(&self) -> Box<dyn StrongMessageChannel<M>>;
fn sink(&self) -> Box<dyn StrongMessageSink<M>>;
}
Expand description
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 MessageChannel
s 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
.
Required Methods
fn downgrade(&self) -> Box<dyn WeakMessageChannel<M>>
fn downgrade(&self) -> Box<dyn WeakMessageChannel<M>>
Create a weak message channel. Unlike with the strong variety of message channel (this kind), an actor will not be prevented from being dropped if only weak sinks, channels, and addresses exist.
fn upcast(self) -> Box<dyn MessageChannel<M>>
fn upcast(self) -> Box<dyn MessageChannel<M>>
Upcasts this strong message channel into a boxed generic
MessageChannel
trait object
fn upcast_ref(&self) -> &dyn MessageChannel<M>
fn upcast_ref(&self) -> &dyn MessageChannel<M>
Upcasts this strong message channel into a reference to the generic
MessageChannel
trait object
fn clone_channel(&self) -> Box<dyn StrongMessageChannel<M>>
fn clone_channel(&self) -> Box<dyn StrongMessageChannel<M>>
Clones this channel as a boxed trait object.
fn sink(&self) -> Box<dyn StrongMessageSink<M>>
fn sink(&self) -> Box<dyn StrongMessageSink<M>>
Use this message channel as a futures Sink
and asynchronously send messages through it.