pub struct Buf { /* private fields */ }
Expand description
Buffer data type.
Implementations§
source§impl Buf
impl Buf
sourcepub fn new_from_bytes(bytes: &[u8]) -> Result<Buf, Box<dyn Error>>
pub fn new_from_bytes(bytes: &[u8]) -> Result<Buf, Box<dyn Error>>
Create a new Buf from the given byte slice
sourcepub fn with_capacity(size: usize) -> Result<Buf>
pub fn with_capacity(size: usize) -> Result<Buf>
Create a Buf with the given capacity - the memory is not initialized
sourcepub fn new_from(other: &impl BufTrait, size: Option<usize>) -> Result<Self>
pub fn new_from(other: &impl BufTrait, size: Option<usize>) -> Result<Self>
Create a duplicate of this Buf - if the optional size parameter is None, the new Buf will have the same size as the existing Buf. Otherwise, the new Buf will have the specified size and data up to that size, or the size of the original buf, whichever is lower, will be copied.
sourcepub fn is_allocated(&self) -> bool
pub fn is_allocated(&self) -> bool
Returns true if the internal buffer is initialized
Trait Implementations§
source§impl From<Buf> for ReadonlyBuf
impl From<Buf> for ReadonlyBuf
source§fn from(buf: Buf) -> ReadonlyBuf
fn from(buf: Buf) -> ReadonlyBuf
Converts to this type from the input type.
impl Copy for Buf
Auto Trait Implementations§
impl RefUnwindSafe for Buf
impl !Send for Buf
impl !Sync for Buf
impl Unpin for Buf
impl UnwindSafe for Buf
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