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.
Trait Implementations§
Auto Trait Implementations§
impl<M> !RefUnwindSafe for Sender<M>
impl<M> Send for Sender<M>where
M: Send,
impl<M> Sync for Sender<M>where
M: Send,
impl<M> Unpin for Sender<M>
impl<M> !UnwindSafe for Sender<M>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more