Struct divbuf::DivBufShared
[−]
[src]
pub struct DivBufShared { /* fields omitted */ }
The "entry point" to the divbuf
crate.
A DivBufShared
owns storage, but cannot directly access it. An
application will typically create an instance of this class for every
independent buffer it wants to manage, and then create child DivBuf
s or
DivBufMut
s to access the storage.
Methods
impl DivBufShared
[src]
fn capacity(&self) -> usize
[src]
Returns the number of bytes the buffer can hold without reallocating.
fn is_empty(&self) -> bool
[src]
Returns true if the DivBufShared
has length 0
fn len(&self) -> usize
[src]
Returns the number of bytes contained in this buffer.
fn try(&self) -> Result<DivBuf, &'static str>
[src]
Try to create a read-only DivBuf
that refers to the entirety of this
buffer. Will fail if there are any DivBufMut
objects referring to
this buffer.
Examples
let dbs = DivBufShared::with_capacity(4096); let db = dbs.try().unwrap();
fn try_mut(&self) -> Result<DivBufMut, &'static str>
[src]
Try to create a mutable DivBufMt
that refers to the entirety of this
buffer. Will fail if there are any DivBufMut
or DivBuf
objects
referring to this buffer.
Examples
let dbs = DivBufShared::with_capacity(4096); let dbm = dbs.try_mut().unwrap();
fn with_capacity(capacity: usize) -> Self
[src]
Creates a new, empty, DivBufShared
with a specified capacity.
After constructing a DivBufShared
this way, it can only be populated
via a child DivBufMut
.
Trait Implementations
impl Debug for DivBufShared
[src]
impl Drop for DivBufShared
[src]
impl<'a> From<&'a [u8]> for DivBufShared
[src]
impl From<Vec<u8>> for DivBufShared
[src]
fn from(src: Vec<u8>) -> DivBufShared
[src]
Performs the conversion.