Trait xtra::message_channel::WeakMessageChannel
source · [−]pub trait WeakMessageChannel<M: Message>: MessageChannel<M> {
fn upcast(self) -> Box<dyn MessageChannel<M>>;
fn upcast_ref(&self) -> &dyn MessageChannel<M>;
fn clone_channel(&self) -> Box<dyn WeakMessageChannel<M>>;
fn sink(&self) -> Box<dyn WeakMessageSink<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 WeakMessageChannel
s 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
.
Required Methods
fn upcast(self) -> Box<dyn MessageChannel<M>>
fn upcast(self) -> Box<dyn MessageChannel<M>>
Upcasts this weak 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 weak message channel into a reference to the generic
MessageChannel
trait object
fn clone_channel(&self) -> Box<dyn WeakMessageChannel<M>>
fn clone_channel(&self) -> Box<dyn WeakMessageChannel<M>>
Clones this channel as a boxed trait object.
fn sink(&self) -> Box<dyn WeakMessageSink<M>>
fn sink(&self) -> Box<dyn WeakMessageSink<M>>
Use this message channel as a futures Sink
and asynchronously send messages through it.