[][src]Struct arrow::buffer::MutableBuffer

pub struct MutableBuffer { /* fields omitted */ }

Similar to Buffer, but is growable and can be mutated. A mutable buffer can be converted into a immutable buffer via the freeze method.

Implementations

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 be zeroed out.

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 raw_data_mut(&mut self) -> *mut u8[src]

pub fn freeze(self) -> Buffer[src]

Freezes this buffer and return an immutable version of it.

pub fn typed_data_mut<T: ArrowNativeType + Num>(&mut self) -> &mut [T][src]

View buffer as typed slice.

pub fn write_bytes(&mut self, bytes: &[u8], len_added: usize) -> Result<()>[src]

Writes a byte slice to the underlying buffer and updates the len, i.e. the number array elements in the buffer. Also, converts the io::Result required by the Write trait to the Arrow Result type.

Trait Implementations

impl Debug for MutableBuffer[src]

impl Drop for MutableBuffer[src]

impl PartialEq<MutableBuffer> for MutableBuffer[src]

impl Send for MutableBuffer[src]

impl Sync for MutableBuffer[src]

impl Write for MutableBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,