[−][src]Struct arrow::buffer::Buffer
Buffer is a contiguous memory region of fixed size and is aligned at a 64-byte boundary. Buffer is immutable.
Implementations
impl Buffer
[src]
pub unsafe fn from_raw_parts(
ptr: *const u8,
len: usize,
capacity: usize
) -> Self
[src]
ptr: *const u8,
len: usize,
capacity: usize
) -> Self
Creates a buffer from an existing memory region (must already be byte-aligned), this
Buffer
will free this piece of memory when dropped.
Arguments
ptr
- Pointer to raw partslen
- Length of raw parts in bytescapacity
- Total allocated memory for the pointerptr
, in bytes
Safety
This function is unsafe as there is no guarantee that the given pointer is valid for len
bytes. If the ptr
and capacity
come from a Buffer
, then this is guaranteed.
pub unsafe fn from_unowned(ptr: *const u8, len: usize, capacity: usize) -> Self
[src]
Creates a buffer from an existing memory region (must already be byte-aligned), this
Buffer
does not free this piece of memory when dropped.
Arguments
ptr
- Pointer to raw partslen
- Length of raw parts in bytescapacity
- Total allocated memory for the pointerptr
, in bytes
Safety
This function is unsafe as there is no guarantee that the given pointer is valid for len
bytes. If the ptr
and capacity
come from a Buffer
, then this is guaranteed.
pub fn len(&self) -> usize
[src]
Returns the number of bytes in the buffer
pub fn capacity(&self) -> usize
[src]
Returns the capacity of this buffer
pub fn is_empty(&self) -> bool
[src]
Returns whether the buffer is empty.
pub fn data(&self) -> &[u8]
[src]
Returns the byte slice stored in this buffer
pub fn slice(&self, offset: usize) -> Self
[src]
Returns a slice of this buffer, starting from offset
.
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 unsafe fn typed_data<T: ArrowNativeType + Num>(&self) -> &[T]
[src]
View buffer as typed slice.
Safety
ArrowNativeType
is public so that it can be used as a trait bound for other public
components, such as the ToByteSlice
trait. However, this means that it can be
implemented by user defined types, which it is not intended for.
Also typed_data::<bool>
is unsafe as 0x00
and 0x01
are the only valid values for
bool
in Rust. However, bool
arrays in Arrow are bit-packed which breaks this condition.
pub fn bit_slice(&self, offset: usize, len: usize) -> Self
[src]
Returns a slice of this buffer starting at a certain bit offset. If the offset is byte-aligned the returned buffer is a shallow clone, otherwise a new buffer is allocated and filled with a copy of the bits in the range.
pub fn bit_chunks(&self, offset: usize, len: usize) -> BitChunks<'_>
[src]
pub fn empty() -> Self
[src]
Returns an empty buffer.
Trait Implementations
impl<'a, 'b> BitAnd<&'b Buffer> for &'a Buffer
[src]
type Output = Result<Buffer>
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'b Buffer) -> Result<Buffer>
[src]
impl<'a, 'b> BitOr<&'b Buffer> for &'a Buffer
[src]
type Output = Result<Buffer>
The resulting type after applying the |
operator.
fn bitor(self, rhs: &'b Buffer) -> Result<Buffer>
[src]
impl Clone for Buffer
[src]
impl Debug for Buffer
[src]
impl From<Buffer> for Bitmap
[src]
impl<T: AsRef<[u8]>> From<T> for Buffer
[src]
Creating a Buffer
instance by copying the memory from a AsRef<[u8]>
into a newly
allocated memory region.
impl<'_> Not for &'_ Buffer
[src]
impl PartialEq<Buffer> for Buffer
[src]
impl Send for Buffer
[src]
impl StructuralPartialEq for Buffer
[src]
impl Sync for Buffer
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut 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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,