Struct ownedbytes::OwnedBytes [−][src]
pub struct OwnedBytes { /* fields omitted */ }Expand description
An OwnedBytes simply wraps an object that owns a slice of data and exposes this data as a static slice.
The backing object is required to be StableDeref.
Implementations
Creates an empty OwnedBytes.
pub fn new<T: StableDeref + Deref<Target = [u8]> + 'static + Send + Sync>(
data_holder: T
) -> OwnedBytesⓘNotable traits for OwnedBytesimpl Read for OwnedBytes
pub fn new<T: StableDeref + Deref<Target = [u8]> + 'static + Send + Sync>(
data_holder: T
) -> OwnedBytesⓘNotable traits for OwnedBytesimpl Read for OwnedBytes
impl Read for OwnedBytesCreates an OwnedBytes intance given a StableDeref object.
creates a fileslice that is just a view over a slice of the data.
Returns the underlying slice of data.
Deref and AsRef are also available.
Splits the OwnedBytes into two OwnedBytes (left, right).
Left will hold split_len bytes.
This operation is cheap and does not require to copy any memory.
On the other hand, both left and right retain a handle over
the entire slice of memory. In other words, the memory will only
be released when both left and right are dropped.
pub fn split_off(&mut self, split_len: usize) -> OwnedBytesⓘNotable traits for OwnedBytesimpl Read for OwnedBytes
pub fn split_off(&mut self, split_len: usize) -> OwnedBytesⓘNotable traits for OwnedBytesimpl Read for OwnedBytes
impl Read for OwnedBytesSplits the right part of the OwnedBytes at the given offset.
self is truncated to split_len, left with the remaining bytes.
Drops the left most advance_len bytes.
See also .clip(clip_len: usize)).
Trait Implementations
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Read all bytes until EOF in this source, placing them into buf. Read more
Read the exact number of bytes required to fill buf. Read more
Like read, except that it reads into a slice of buffers. Read more
can_vector)Determines if this Reader has an efficient read_vectored
implementation. Read more
read_initializer)Determines if this Reader can work with buffers of uninitialized
memory. Read more
Read all bytes until EOF in this source, appending them to buf. Read more
Creates a “by reference” adapter for this instance of Read. Read more
Creates an adapter which will chain this stream with another. Read more
Auto Trait Implementations
impl !RefUnwindSafe for OwnedBytes
impl Send for OwnedBytes
impl Sync for OwnedBytes
impl Unpin for OwnedBytes
impl !UnwindSafe for OwnedBytes
Blanket Implementations
Mutably borrows from an owned value. Read more