pub struct CopyBuffer { /* private fields */ }Expand description
A fixed-capacity byte buffer supporting copy-in and copy-out operations.
Implementations§
Source§impl CopyBuffer
impl CopyBuffer
pub fn new(capacity: usize) -> Self
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn remaining(&self) -> usize
Sourcepub fn copy_in(&mut self, src: &[u8]) -> usize
pub fn copy_in(&mut self, src: &[u8]) -> usize
Copy bytes in. Returns number of bytes actually written.
Sourcepub fn copy_out(&mut self, n: usize) -> Vec<u8> ⓘ
pub fn copy_out(&mut self, n: usize) -> Vec<u8> ⓘ
Copy out up to n bytes from the front. Returns the slice.
pub fn clear(&mut self)
pub fn as_slice(&self) -> &[u8] ⓘ
Sourcepub fn set_byte(&mut self, pos: usize, byte: u8) -> bool
pub fn set_byte(&mut self, pos: usize, byte: u8) -> bool
Overwrite byte at position; returns false if out of range.
pub fn get_byte(&self, pos: usize) -> Option<u8>
Trait Implementations§
Source§impl Clone for CopyBuffer
impl Clone for CopyBuffer
Source§fn clone(&self) -> CopyBuffer
fn clone(&self) -> CopyBuffer
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 Freeze for CopyBuffer
impl RefUnwindSafe for CopyBuffer
impl Send for CopyBuffer
impl Sync for CopyBuffer
impl Unpin for CopyBuffer
impl UnsafeUnpin for CopyBuffer
impl UnwindSafe for CopyBuffer
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