pub trait Sender<M, EP = DefaultEnvelopeProxy<M>>: SenderIndexwhere
M: Message<EP>,
EP: 'static,{
// Required methods
fn is_closed(&self) -> bool;
fn capacity(&self) -> usize;
fn send(
&self,
msg: M,
) -> Pin<Box<dyn Future<Output = Result<Receiver<M::Result>, SendError<M>>> + Send + '_>>;
fn do_send(
&self,
msg: M,
) -> Pin<Box<dyn Future<Output = Result<(), SendError<M>>> + Send + '_>>;
fn try_send(&self, msg: M) -> Result<Receiver<M::Result>, TrySendError<M>>;
fn try_do_send(&self, msg: M) -> Result<(), TrySendError<M>>;
fn blocking_send(&self, msg: M) -> Result<Receiver<M::Result>, SendError<M>>;
fn blocking_do_send(&self, msg: M) -> Result<(), SendError<M>>;
fn boxed(&self) -> Box<dyn Sender<M, EP> + Send + Sync>;
}Expand description
Describes how to send a message.
Required Methods§
Sourcefn send(
&self,
msg: M,
) -> Pin<Box<dyn Future<Output = Result<Receiver<M::Result>, SendError<M>>> + Send + '_>>
fn send( &self, msg: M, ) -> Pin<Box<dyn Future<Output = Result<Receiver<M::Result>, SendError<M>>> + Send + '_>>
Sends a message and returns a oneshot::Receiver which could be used to receive
the response.
Sourcefn do_send(
&self,
msg: M,
) -> Pin<Box<dyn Future<Output = Result<(), SendError<M>>> + Send + '_>>
fn do_send( &self, msg: M, ) -> Pin<Box<dyn Future<Output = Result<(), SendError<M>>> + Send + '_>>
Sends a message without expecting a response.
Sourcefn try_send(&self, msg: M) -> Result<Receiver<M::Result>, TrySendError<M>>
fn try_send(&self, msg: M) -> Result<Receiver<M::Result>, TrySendError<M>>
Attempts to send a message and returns a oneshot::Receiver which could be used to
receive the response.
Sourcefn try_do_send(&self, msg: M) -> Result<(), TrySendError<M>>
fn try_do_send(&self, msg: M) -> Result<(), TrySendError<M>>
Attempts to send a message without expecting a response.
Sourcefn blocking_send(&self, msg: M) -> Result<Receiver<M::Result>, SendError<M>>
fn blocking_send(&self, msg: M) -> Result<Receiver<M::Result>, SendError<M>>
Sends a message and returns a oneshot::Receiver which could be used to receive
the response.
This method is intended for use cases where you are sending from synchronous code.
Sourcefn blocking_do_send(&self, msg: M) -> Result<(), SendError<M>>
fn blocking_do_send(&self, msg: M) -> Result<(), SendError<M>>
Sends a message to an actor without expecting a response.
This method is intended for use cases where you are sending from synchronous code.