asimov_core::flow

Trait MessageSender

source
pub trait MessageSender<T>
where T: Message,
{ // Provided methods fn send<'a>(&self, _message: impl Into<&'a T>) -> Result<(), PortError> where T: 'a { ... } fn try_send<'a>( &self, _message: impl Into<&'a T>, ) -> Result<bool, PortError> where T: 'a { ... } }

Provided Methods§

source

fn send<'a>(&self, _message: impl Into<&'a T>) -> Result<(), PortError>
where T: 'a,

Sends a message, blocking until it has been sent.

Returns Ok(()) if the message was sent. Returns Err(PortError::Disconnected) if the port is disconnected. Returns Err(PortError::Closed) if the port is closed. Returns Err(PortError) if another error occurs.

source

fn try_send<'a>(&self, _message: impl Into<&'a T>) -> Result<bool, PortError>
where T: 'a,

Tries to send a message, returning immediately.

Returns Ok(true) if the message was sent. Returns Ok(false) if the message could not be immediately sent. Returns Err(PortError::Disconnected) if the port is disconnected. Returns Err(PortError::Closed) if the port is closed. Returns Err(PortError) if another error occurs.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> MessageSender<T> for OutputPort<T>
where T: Message,

source§

impl<T, const N: usize> MessageSender<T> for OutputPorts<T, N>
where T: Message,