pub struct ReceiveBuffer<const N: usize> { /* private fields */ }
Implementations§
Source§impl<const N: usize> ReceiveBuffer<N>
impl<const N: usize> ReceiveBuffer<N>
Sourcepub fn available(&self) -> usize
pub fn available(&self) -> usize
Returns the number of available bytes remaining in the buffer.
Sourcepub fn init_seq_num(&self) -> u16
pub fn init_seq_num(&self) -> u16
Returns the initial sequence number of the buffer.
Sourcepub fn was_written(&self, seq_num: u16) -> bool
pub fn was_written(&self, seq_num: u16) -> bool
Returns true
if data was already written into the buffer for seq_num
.
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Reads data from the buffer into buf
, returning the number of bytes read.
Sourcepub fn write(&mut self, data: &[u8], seq_num: u16)
pub fn write(&mut self, data: &[u8], seq_num: u16)
Writes data
into the buffer at seq_num
.
§Panics
Panics if data.len()
is greater than the amount of available bytes in the buffer and the
data for seq_num
has not already been written.
Sourcepub fn ack_num(&self) -> u16
pub fn ack_num(&self) -> u16
Returns the last sequence number in a contiguous sequence from the initial sequence number.
Sourcepub fn selective_ack(&self) -> Option<SelectiveAck>
pub fn selective_ack(&self) -> Option<SelectiveAck>
Returns a selective ACK based on the sequence of data written into the buffer.
Trait Implementations§
Source§impl<const N: usize> Clone for ReceiveBuffer<N>
impl<const N: usize> Clone for ReceiveBuffer<N>
Source§fn clone(&self) -> ReceiveBuffer<N>
fn clone(&self) -> ReceiveBuffer<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<const N: usize> Freeze for ReceiveBuffer<N>
impl<const N: usize> RefUnwindSafe for ReceiveBuffer<N>
impl<const N: usize> Send for ReceiveBuffer<N>
impl<const N: usize> Sync for ReceiveBuffer<N>
impl<const N: usize> Unpin for ReceiveBuffer<N>
impl<const N: usize> UnwindSafe for ReceiveBuffer<N>
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