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]
impl DivBufShared
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
Returns the number of bytes the buffer can hold without reallocating.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true if the DivBufShared
has length 0
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of bytes contained in this buffer.
pub fn try(&self) -> Result<DivBuf, &'static str>
[src]
pub fn try(&self) -> Result<DivBuf, &'static str>
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();
pub fn try_mut(&self) -> Result<DivBufMut, &'static str>
[src]
pub fn try_mut(&self) -> Result<DivBufMut, &'static str>
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();
pub fn with_capacity(capacity: usize) -> Self
[src]
pub fn with_capacity(capacity: usize) -> Self
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 Debug for DivBufShared
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Drop for DivBufShared
[src]
impl Drop for DivBufShared
impl<'a> From<&'a [u8]> for DivBufShared
[src]
impl<'a> From<&'a [u8]> for DivBufShared
impl From<Vec<u8>> for DivBufShared
[src]
impl From<Vec<u8>> for DivBufShared
fn from(src: Vec<u8>) -> DivBufShared
[src]
fn from(src: Vec<u8>) -> DivBufShared
Performs the conversion.
impl Send for DivBufShared
[src]
impl Send for DivBufShared
impl Sync for DivBufShared
[src]
impl Sync for DivBufShared