Struct divbuf::DivBufShared

source ·
pub struct DivBufShared { /* private fields */ }
Expand description

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 DivBufs or DivBufMuts to access the storage.

Implementations

Returns the number of bytes the buffer can hold without reallocating.

Returns true if the DivBufShared has length 0

Returns the number of bytes contained in this buffer.

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_const().unwrap();

Try to create a mutable DivBufMut 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();

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

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.