pub struct WriteHalf<'a, M: RingMem> { /* private fields */ }
Expand description
The writer for the outgoing ring buffer of a Queue
.
Implementations§
Source§impl<'a, M: RingMem> WriteHalf<'a, M>
impl<'a, M: RingMem> WriteHalf<'a, M>
Sourcepub fn poll_ready(
&mut self,
cx: &mut Context<'_>,
send_size: usize,
) -> Poll<Result<(), Error>>
pub fn poll_ready( &mut self, cx: &mut Context<'_>, send_size: usize, ) -> Poll<Result<(), Error>>
Polls the outgoing ring for the ability to send a packet of size
send_size
.
send_size
can be computed by calling try_write
and extracting the
size from TryReadError::Full(send_size)
.
Sourcepub async fn wait_ready(&mut self, send_size: usize) -> Result<(), Error>
pub async fn wait_ready(&mut self, send_size: usize) -> Result<(), Error>
Waits until there is enough space in the ring to send a packet of size
send_size
.
send_size
can be computed by calling try_write
and extracting the
size from TryReadError::Full(send_size)
.
Sourcepub fn batched(&mut self) -> WriteBatch<'_, M>
pub fn batched(&mut self) -> WriteBatch<'_, M>
Returns an object for writing multiple packets at once.
The batch will be committed when the returned object is dropped.
This reduces the overhead of writing multiple packets by updating the ring pointers and signaling an interrupt only once, when the batch is committed.
Sourcepub fn can_write(&mut self, send_size: usize) -> Result<bool, Error>
pub fn can_write(&mut self, send_size: usize) -> Result<bool, Error>
Checks the outgiong ring for the capacity to send a packet of size
send_size
.
Sourcepub fn try_write(
&mut self,
packet: &OutgoingPacket<'_, '_>,
) -> Result<(), TryWriteError>
pub fn try_write( &mut self, packet: &OutgoingPacket<'_, '_>, ) -> Result<(), TryWriteError>
Tries to write a packet into the outgoing ring.
Fails with TryReadError::Full(send_size)
if the ring is full.
Sourcepub fn poll_write(
&mut self,
cx: &mut Context<'_>,
packet: &OutgoingPacket<'_, '_>,
) -> Poll<Result<(), Error>>
pub fn poll_write( &mut self, cx: &mut Context<'_>, packet: &OutgoingPacket<'_, '_>, ) -> Poll<Result<(), Error>>
Polls the ring for successful write of packet
.
Sourcepub fn write<'b, 'c>(
&'b mut self,
packet: OutgoingPacket<'c, 'b>,
) -> Write<'a, 'b, 'c, M> ⓘ
pub fn write<'b, 'c>( &'b mut self, packet: OutgoingPacket<'c, 'b>, ) -> Write<'a, 'b, 'c, M> ⓘ
Writes a packet.