pub struct Connection { /* private fields */ }Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn connect(subscriber: &Subscriber, path: Path) -> Result<Connection>
pub async fn connect(subscriber: &Subscriber, path: Path) -> Result<Connection>
Connect to the channel at the the specified path. The channel may either be a listener, or a singleton.
Sourcepub fn start_batch(&self) -> Batch
pub fn start_batch(&self) -> Batch
start a new batch of messages
Sourcepub fn dirty(&self) -> bool
pub fn dirty(&self) -> bool
return true if messages have been sent but not flushed. Flush is only required for pushback.
Sourcepub async fn recv<R: Pack + 'static, F: FnMut(R) -> bool>(
&self,
f: F,
) -> Result<()>
pub async fn recv<R: Pack + 'static, F: FnMut(R) -> bool>( &self, f: F, ) -> Result<()>
Receive all avaliable messages, waiting for at least one message to arrive before returning. Each message will be passed to f, if f returns false, then processing the batch will be halted and any remaining messages will stay in the channel.
Sourcepub async fn try_recv<R: Pack + 'static, F: FnMut(R) -> bool>(
&self,
f: F,
) -> Result<()>
pub async fn try_recv<R: Pack + 'static, F: FnMut(R) -> bool>( &self, f: F, ) -> Result<()>
Receive all available messages, but do not wait for at least 1 message to arrive. If no messages are available return immediatly. This will only block if a concurrent receive is in progress.
Sourcepub async fn recv_one<R: Pack + 'static>(&self) -> Result<R>
pub async fn recv_one<R: Pack + 'static>(&self) -> Result<R>
Receive one message, waiting for at least one message to arrive if none are queued.
Sourcepub async fn try_recv_one<R: Pack + 'static>(&self) -> Result<Option<R>>
pub async fn try_recv_one<R: Pack + 'static>(&self) -> Result<Option<R>>
Receive a message if one is available, otherwise return Ok(None).