Struct ArrayBuffer
pub struct ArrayBuffer<const N: usize> {
buf: [u8; N],
head: usize,
tail: usize,
}Expand description
A fixed-capacity ByteBuffer backed by an inline [u8; N].
The buffer for no_std/no-alloc targets: it never allocates and bounds the
total buffered bytes to N. When the tail fills but space has been freed at
the front, the live bytes are compacted down; only once N bytes are
genuinely live does spare return
CapacityExceeded.
N should be at least as large as the largest packet the client will
accept or send plus room for any bytes of a following packet read in the
same chunk.
Fields§
§buf: [u8; N]§head: usizeStart of the live region.
tail: usizeOne past the end of the live region.
Implementations§
§impl<const N: usize> ArrayBuffer<N>
impl<const N: usize> ArrayBuffer<N>
pub const fn new() -> Self
pub const fn new() -> Self
Creates an empty buffer.
Trait Implementations§
§impl<const N: usize> ByteBuffer for ArrayBuffer<N>
impl<const N: usize> ByteBuffer for ArrayBuffer<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for ArrayBuffer<N>
impl<const N: usize> RefUnwindSafe for ArrayBuffer<N>
impl<const N: usize> Send for ArrayBuffer<N>
impl<const N: usize> Sync for ArrayBuffer<N>
impl<const N: usize> Unpin for ArrayBuffer<N>
impl<const N: usize> UnwindSafe for ArrayBuffer<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