[][src]Trait xtra_addons::StrongMessageChannel

pub trait StrongMessageChannel<M>: MessageChannel<M> where
    M: Message
{ pub fn downgrade(&self) -> Box<dyn WeakMessageChannel<M> + 'static, Global>;
pub fn upcast(self) -> Box<dyn MessageChannel<M> + 'static, Global>;
pub fn upcast_ref(&self) -> &dyn MessageChannel<M>;
pub fn clone_channel(
        &self
    ) -> Box<dyn StrongMessageChannel<M> + 'static, Global>;
pub fn sink(
        &self
    ) -> Box<dyn StrongMessageSink<M, Error = Disconnected> + 'static, Global>; }

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.

Required methods

pub fn downgrade(&self) -> Box<dyn WeakMessageChannel<M> + 'static, Global>[src]

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.

pub fn upcast(self) -> Box<dyn MessageChannel<M> + 'static, Global>[src]

Upcasts this strong message channel into a boxed generic MessageChannel trait object

pub fn upcast_ref(&self) -> &dyn MessageChannel<M>[src]

Upcasts this strong message channel into a reference to the generic MessageChannel trait object

pub fn clone_channel(
    &self
) -> Box<dyn StrongMessageChannel<M> + 'static, Global>
[src]

Clones this channel as a boxed trait object.

pub fn sink(
    &self
) -> Box<dyn StrongMessageSink<M, Error = Disconnected> + 'static, Global>
[src]

Use this message channel as a futures Sink and asynchronously send messages through it.

Loading content...

Implementors

impl<A, M> StrongMessageChannel<M> for Address<A, Strong> where
    A: Handler<M>,
    M: Message
[src]

pub fn upcast(self) -> Box<dyn MessageChannel<M> + 'static, Global>[src]

Upcasts this strong message channel into a boxed generic MessageChannel trait object

pub fn upcast_ref(&self) -> &dyn MessageChannel<M>[src]

Upcasts this strong message channel into a reference to the generic MessageChannel trait object

Loading content...