Struct capnp_futures::Sender
source · pub struct Sender<M>where
M: AsOutputSegments,{ /* private fields */ }
Expand description
A handle that allows messages to be sent to a write queue.
Implementations§
source§impl<M> Sender<M>where
M: AsOutputSegments,
impl<M> Sender<M>where
M: AsOutputSegments,
sourcepub fn send(
&mut self,
message: M
) -> impl Future<Output = Result<M, Error>> + Unpin
pub fn send(
&mut self,
message: M
) -> impl Future<Output = Result<M, Error>> + Unpin
Enqueues a message to be written. The returned future resolves once the write has completed.
pub fn is_empty(&self) -> bool
sourcepub fn terminate(
&mut self,
result: Result<(), Error>
) -> impl Future<Output = Result<(), Error>> + Unpin
pub fn terminate(
&mut self,
result: Result<(), Error>
) -> impl Future<Output = Result<(), Error>> + Unpin
Commands the queue to stop writing messages once it is empty. After this method has been called,
any new calls to send()
will return a future that immediately resolves to an error.
If the passed-in result
is an error, then the WriteQueue
will resolve to that error.