Struct narrow::bitmap::Bitmap

source ·
pub struct Bitmap<Buffer: BufferType = VecBuffer> { /* private fields */ }
Expand description

A collection of bits.

The validity bits are stored LSB-first in the bytes of the Buffer.

Implementations§

source§

impl<Buffer: BufferType> Bitmap<Buffer>

source

pub fn iter(&self) -> BitmapIter<'_>

Returns an iterator over the bits in this Bitmap.

source

pub unsafe fn from_raw_parts( buffer: <Buffer as BufferType>::Buffer<u8>, bits: usize, offset: usize, ) -> Self

Forms a Bitmap from a buffer, a number of bits and an offset (in bits).

§Safety

Caller must ensure that the buffer contains enough bytes for the specified number of bits including the offset.

source

pub fn get(&self, index: usize) -> Option<bool>

Returns the bit at given bit index. Returns None when the index is out of bounds.

source

pub unsafe fn get_unchecked(&self, index: usize) -> bool

Returns the bit at given bit index. Skips bound checking.

§Safety

Caller must ensure index is within bounds.

source

pub fn leading_bits(&self) -> usize

Returns the number of leading padding bits in the first byte(s) of the buffer that contain no meaningful bits. These bits should be ignored when inspecting the raw byte buffer.

source

pub fn trailing_bits(&self) -> usize

Returns the number of trailing padding bits in the last byte of the buffer that contain no meaningful bits. These bits should be ignored when inspecting the raw byte buffer.

source

pub fn bit_index(&self, index: usize) -> usize

Returns the bit index for the element at the provided index. See Bitmap::byte_index.

source

pub fn byte_index(&self, index: usize) -> usize

Returns the byte index for the element at the provided index. See Bitmap::bit_index.

source

pub fn new_valid(len: usize) -> Self
where Self: FromIterator<bool>,

Returns a Bitmap with len bits set.

Trait Implementations§

source§

impl<Buffer: BufferType> BitmapRef for Bitmap<Buffer>

§

type Buffer = Buffer

The buffer type of the bitmap.
source§

fn bitmap_ref(&self) -> &Bitmap<Self::Buffer>

Returns a reference to an immutable Bitmap.
source§

impl<Buffer: BufferType> BufferRef<u8> for Bitmap<Buffer>

§

type Buffer = <Buffer as BufferType>::Buffer<u8>

The Buffer type.
source§

fn buffer_ref(&self) -> &Self::Buffer

Returns an immutable reference to a buffer.
source§

impl<Buffer: BufferType> BufferRefMut<u8> for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: BufferMut<u8>,

§

type BufferMut = <Buffer as BufferType>::Buffer<u8>

The BufferMut type.
source§

fn buffer_ref_mut(&mut self) -> &mut Self::BufferMut

Returns a mutable reference to a buffer.
source§

impl<Buffer: BufferType> Clone for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Buffer: BufferType> Debug for Bitmap<Buffer>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Buffer: BufferType> Default for Bitmap<Buffer>
where Buffer::Buffer<u8>: Default,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T, Buffer: BufferType> Extend<T> for Bitmap<Buffer>
where T: Borrow<bool>, <Buffer as BufferType>::Buffer<u8>: BufferMut<u8> + Extend<u8>,

source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<Buffer: BufferType> From<Bitmap<Buffer>> for BooleanBuffer
where <Buffer as BufferType>::Buffer<u8>: Into<Buffer>,

Available on crate feature arrow-rs only.
source§

fn from(value: Bitmap<Buffer>) -> Self

Converts to this type from the input type.
source§

impl<Buffer: BufferType> From<Bitmap<Buffer>> for NullBuffer
where BooleanBuffer: From<Bitmap<Buffer>>,

Available on crate feature arrow-rs only.
source§

fn from(value: Bitmap<Buffer>) -> Self

Converts to this type from the input type.
source§

impl<Buffer: BufferType> From<BooleanBuffer> for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: From<ScalarBuffer<u8>>,

Available on crate feature arrow-rs only.
source§

fn from(value: BooleanBuffer) -> Self

Converts to this type from the input type.
source§

impl<Buffer: BufferType> From<NullBuffer> for Bitmap<Buffer>
where Bitmap<Buffer>: From<BooleanBuffer>,

Available on crate feature arrow-rs only.
source§

fn from(value: NullBuffer) -> Self

Converts to this type from the input type.
source§

impl<Buffer: BufferType, T> FromIterator<T> for Bitmap<Buffer>
where T: Borrow<bool>, <Buffer as BufferType>::Buffer<u8>: FromIterator<u8>,

source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
source§

impl<Buffer: BufferType> Index<usize> for Bitmap<Buffer>

§

type Output = bool

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<Buffer: BufferType> Index for Bitmap<Buffer>

§

type Item<'a> = bool where Self: 'a

The item.
source§

unsafe fn index_unchecked(&self, index: usize) -> Self::Item<'_>

Returns the value at given index. Skips bound checking. Read more
source§

fn index(&self, index: usize) -> Option<Self::Item<'_>>

Returns the value at given index. Returns None if the index is out of range.
source§

fn index_checked(&self, index: usize) -> Self::Item<'_>

Returns the value at given index. Panics if the index is out of bounds. Read more
source§

impl<'a, Buffer: BufferType> IntoIterator for &'a Bitmap<Buffer>

§

type Item = bool

The type of the elements being iterated over.
§

type IntoIter = Take<Skip<BitUnpacked<Iter<'a, u8>, &'a u8>>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<Buffer: BufferType> IntoIterator for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: IntoIterator<Item = u8>,

§

type Item = bool

The type of the elements being iterated over.
§

type IntoIter = Take<Skip<BitUnpacked<<<Buffer as BufferType>::Buffer<u8> as IntoIterator>::IntoIter, u8>>>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<Buffer: BufferType> Length for Bitmap<Buffer>

source§

fn len(&self) -> usize

Returns the number of elements in the collection, also referred to as its length.
source§

fn is_empty(&self) -> bool

Returns true if there are no elements in the collection.
source§

impl<const N: usize, Buffer: BufferType> PartialEq<[bool; N]> for Bitmap<Buffer>

source§

fn eq(&self, other: &[bool; N]) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Buffer: BufferType> PartialEq<Bitmap<Buffer>> for BooleanBuffer

Available on crate feature arrow-rs only.
source§

fn eq(&self, other: &Bitmap<Buffer>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Buffer: BufferType> PartialEq<Bitmap<Buffer>> for NullBuffer

Available on crate feature arrow-rs only.
source§

fn eq(&self, other: &Bitmap<Buffer>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Buffer: BufferType> PartialEq<BooleanBuffer> for Bitmap<Buffer>

Available on crate feature arrow-rs only.
source§

fn eq(&self, other: &BooleanBuffer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Buffer: BufferType> PartialEq<NullBuffer> for Bitmap<Buffer>

Available on crate feature arrow-rs only.
source§

fn eq(&self, other: &NullBuffer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Buffer: BufferType> PartialEq for Bitmap<Buffer>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Buffer: BufferType> ValidityBitmap for Bitmap<Buffer>

source§

fn is_null(&self, index: usize) -> Option<bool>

Returns true if the element at position index is null.
source§

unsafe fn is_null_unchecked(&self, index: usize) -> bool

Returns true if the element at position index is null, without performing any bounds checking. Read more
source§

fn null_count(&self) -> usize

Returns the number of null elements.
source§

fn is_valid(&self, index: usize) -> Option<bool>

Returns true if the element at position index is valid.
source§

unsafe fn is_valid_unchecked(&self, index: usize) -> bool

Returns true if the element at position index is valid, without performing any bounds checking. Read more
source§

fn valid_count(&self) -> usize

Returns the number of valid elements.
source§

fn any_null(&self) -> bool

Returns true if the array contains at least one null element.
source§

fn all_null(&self) -> bool

Returns true if all the elements are null.
source§

fn any_valid(&self) -> bool

Returns true if the array contains at least one valid element.
source§

fn all_valid(&self) -> bool

Returns true if all the elements are valid.

Auto Trait Implementations§

§

impl<Buffer> Freeze for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: Freeze,

§

impl<Buffer> RefUnwindSafe for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: RefUnwindSafe,

§

impl<Buffer> Send for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: Send,

§

impl<Buffer> Sync for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: Sync,

§

impl<Buffer> Unpin for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: Unpin,

§

impl<Buffer> UnwindSafe for Bitmap<Buffer>
where <Buffer as BufferType>::Buffer<u8>: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,