pub struct ByteBuffer { /* private fields */ }
Expand description
Naive buffer.
FIXME: if pos and limit never catch up, buffer will overflow, when there might be some extra capacity
Implementations§
Source§impl ByteBuffer
impl ByteBuffer
pub fn new() -> ByteBuffer
pub fn with_capacity(cap: usize) -> ByteBuffer
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
pub fn write(&mut self, b: &[u8]) -> Result<()>
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
pub fn slice<'a>(&'a self, offset: usize) -> &'a [u8] ⓘ
pub fn mut_slice<'a>(&'a mut self, offset: usize) -> &'a mut [u8] ⓘ
pub fn extend(&mut self, cnt: usize)
pub fn consume(&mut self, cnt: usize)
pub fn clear(&mut self)
Trait Implementations§
Source§impl Clone for ByteBuffer
impl Clone for ByteBuffer
Source§fn clone(&self) -> ByteBuffer
fn clone(&self) -> ByteBuffer
Returns a copy 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 moreSource§impl Debug for ByteBuffer
impl Debug for ByteBuffer
Source§impl<'a> From<&'a ByteBuffer> for &'a [u8]
impl<'a> From<&'a ByteBuffer> for &'a [u8]
Auto Trait Implementations§
impl Freeze for ByteBuffer
impl RefUnwindSafe for ByteBuffer
impl Send for ByteBuffer
impl Sync for ByteBuffer
impl Unpin for ByteBuffer
impl UnwindSafe for ByteBuffer
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