[−][src]Struct arrow::buffer::MutableBuffer
Similar to Buffer
, but is growable and can be mutated. A mutable buffer can be
converted into a immutable buffer via the freeze
method.
Methods
impl MutableBuffer
[src]
pub fn new(capacity: usize) -> Self
[src]
Allocate a new mutable buffer with initial capacity to be capacity
.
pub fn with_bitset(self, end: usize, val: bool) -> Self
[src]
Set the bits in the range of [0, end)
to 0 (if val
is false), or 1 (if val
is true). Also extend the length of this buffer to be end
.
This is useful when one wants to clear (or set) the bits and then manipulate
the buffer directly (e.g., modifying the buffer by holding a mutable reference
from data_mut()
).
pub fn set_null_bits(&mut self, start: usize, count: usize)
[src]
Ensure that count
bytes from start
contain zero bits
This is used to initialize the bits in a buffer, however, it has no impact on the
len
of the buffer and so can be used to initialize the memory region from
len
to capacity
.
pub fn reserve(&mut self, capacity: usize) -> Result<usize>
[src]
Ensures that this buffer has at least capacity
slots in this buffer. This will
also ensure the new capacity will be a multiple of 64 bytes.
Returns the new capacity for this buffer.
pub fn resize(&mut self, new_len: usize) -> Result<()>
[src]
Resizes the buffer so that the len
will equal to the new_len
.
If new_len
is greater than len
, the buffer's length is simply adjusted to be
the former, optionally extending the capacity. The data between len
and
new_len
will remain unchanged.
If new_len
is less than len
, the buffer will be truncated.
pub fn is_empty(&self) -> bool
[src]
Returns whether this buffer is empty or not.
pub fn len(&self) -> usize
[src]
Returns the length (the number of bytes written) in this buffer.
pub fn capacity(&self) -> usize
[src]
Returns the total capacity in this buffer.
pub fn clear(&mut self)
[src]
Clear all existing data from this buffer.
pub fn data(&self) -> &[u8]
[src]
Returns the data stored in this buffer as a slice.
pub fn data_mut(&mut self) -> &mut [u8]
[src]
Returns the data stored in this buffer as a mutable slice.
pub fn raw_data(&self) -> *const u8
[src]
Returns a raw pointer for this buffer.
Note that this should be used cautiously, and the returned pointer should not be stored anywhere, to avoid dangling pointers.
pub fn freeze(self) -> Buffer
[src]
Freezes this buffer and return an immutable version of it.
Trait Implementations
impl Drop for MutableBuffer
[src]
impl PartialEq<MutableBuffer> for MutableBuffer
[src]
fn eq(&self, other: &MutableBuffer) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Send for MutableBuffer
[src]
impl Sync for MutableBuffer
[src]
impl Debug for MutableBuffer
[src]
impl Write for MutableBuffer
[src]
fn write(&mut self, buf: &[u8]) -> IoResult<usize>
[src]
fn flush(&mut self) -> IoResult<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>
1.36.0[src]
Like write
, except that it writes from a slice of buffers. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
Attempts to write an entire buffer into this writer. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Write
. Read more
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> FromCast<T> for T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
[src]
U: FromCast<T>,