pub struct DataBlock<Block> { /* private fields */ }
Expand description
Traversable bit block with offset.
Implementations§
Source§impl<Block: BitBlock> DataBlock<Block>
impl<Block: BitBlock> DataBlock<Block>
Sourcepub fn new(start_index: usize, bit_block: Block) -> DataBlock<Block>
pub fn new(start_index: usize, bit_block: Block) -> DataBlock<Block>
§Panics
Panics if start_index
does not match Block
align.
Sourcepub unsafe fn new_unchecked(
start_index: usize,
bit_block: Block,
) -> DataBlock<Block>
pub unsafe fn new_unchecked( start_index: usize, bit_block: Block, ) -> DataBlock<Block>
§Safety
start_index
must match Block
align.
Sourcepub fn into_parts(self) -> (usize, Block)
pub fn into_parts(self) -> (usize, Block)
Destruct DataBlock
into (start_index, bit_block)
.
Sourcepub fn traverse<F, B>(&self, f: F) -> ControlFlow<B>
pub fn traverse<F, B>(&self, f: F) -> ControlFlow<B>
traverse approx. 15% faster then iterator
pub fn for_each<F>(&self, f: F)
pub fn iter(&self) -> DataBlockIter<Block> ⓘ
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Calculate elements count in DataBlock.
On most platforms, this should be faster then manually traversing DataBlock and counting elements. It use hardware accelerated “popcnt”, whenever possible.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<'de, Block> Deserialize<'de> for DataBlock<Block>where
Block: Deserialize<'de>,
impl<'de, Block> Deserialize<'de> for DataBlock<Block>where
Block: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<Conf: Config> Extend<DataBlock<<Conf as Config>::DataBitBlock>> for BitSet<Conf>
impl<Conf: Config> Extend<DataBlock<<Conf as Config>::DataBitBlock>> for BitSet<Conf>
Source§fn extend<T: IntoIterator<Item = DataBlock<Conf::DataBitBlock>>>(
&mut self,
iter: T,
)
fn extend<T: IntoIterator<Item = DataBlock<Conf::DataBitBlock>>>( &mut self, iter: T, )
It is allowed for blocks with the same range to repeat in iterator.
Like ([1,42], [15,27,61])
. Their data will be merged.
Source§fn extend_one(&mut self, item: A)
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)
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<Conf: Config> From<&DataBlock<<Conf as Config>::DataBitBlock>> for BlockCursor<Conf>
impl<Conf: Config> From<&DataBlock<<Conf as Config>::DataBitBlock>> for BlockCursor<Conf>
Source§fn from(block: &DataBlock<Conf::DataBitBlock>) -> Self
fn from(block: &DataBlock<Conf::DataBitBlock>) -> Self
Build cursor that points to the block
.
Source§impl<Conf: Config> From<&DataBlock<<Conf as Config>::DataBitBlock>> for IndexCursor<Conf>
impl<Conf: Config> From<&DataBlock<<Conf as Config>::DataBitBlock>> for IndexCursor<Conf>
Source§fn from(block: &DataBlock<Conf::DataBitBlock>) -> Self
fn from(block: &DataBlock<Conf::DataBitBlock>) -> Self
Build cursor that points to the block
start index.
Source§impl<Conf: Config> FromIterator<DataBlock<<Conf as Config>::DataBitBlock>> for BitSet<Conf>
impl<Conf: Config> FromIterator<DataBlock<<Conf as Config>::DataBitBlock>> for BitSet<Conf>
Source§fn from_iter<T: IntoIterator<Item = DataBlock<Conf::DataBitBlock>>>(
iter: T,
) -> Self
fn from_iter<T: IntoIterator<Item = DataBlock<Conf::DataBitBlock>>>( iter: T, ) -> Self
It is allowed for blocks with the same range to repeat in iterator.
Like ([1,42], [15,27,61])
. Their data will be merged.
Source§impl<Block: BitBlock> IntoIterator for DataBlock<Block>
impl<Block: BitBlock> IntoIterator for DataBlock<Block>
impl<Block: Eq> Eq for DataBlock<Block>
impl<Block> StructuralPartialEq for DataBlock<Block>
Auto Trait Implementations§
impl<Block> Freeze for DataBlock<Block>where
Block: Freeze,
impl<Block> RefUnwindSafe for DataBlock<Block>where
Block: RefUnwindSafe,
impl<Block> Send for DataBlock<Block>where
Block: Send,
impl<Block> Sync for DataBlock<Block>where
Block: Sync,
impl<Block> Unpin for DataBlock<Block>where
Block: Unpin,
impl<Block> UnwindSafe for DataBlock<Block>where
Block: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more