#[repr(C)]pub struct CellDescriptor {
pub d1: u8,
pub d2: u8,
}Expand description
Tightly packed info about a cell.
Fields§
§d1: u8First descriptor byte with a generic info about cell.
d2: u8Second descriptor byte with a packed data size.
Implementations§
Source§impl CellDescriptor
impl CellDescriptor
Sourcepub const REF_COUNT_MASK: u8 = 7u8
pub const REF_COUNT_MASK: u8 = 7u8
Bit mask to store the number of references in the descriptor.
Sourcepub const IS_EXOTIC_MASK: u8 = 8u8
pub const IS_EXOTIC_MASK: u8 = 8u8
Bit mask to store the is_exotic flag in the descriptor.
Sourcepub const STORE_HASHES_MASK: u8 = 16u8
pub const STORE_HASHES_MASK: u8 = 16u8
Bit mask to store the store_hashes flag in the descriptor.
Sourcepub const LEVEL_MASK: u8 = 224u8
pub const LEVEL_MASK: u8 = 224u8
de Brujn level presence mask in the descriptor.
Sourcepub const fn compute_d1(
level_mask: LevelMask,
is_exotic: bool,
ref_count: u8,
) -> u8
pub const fn compute_d1( level_mask: LevelMask, is_exotic: bool, ref_count: u8, ) -> u8
Computes d1 descriptor byte from parts
Sourcepub const fn compute_d2(bit_len: u16) -> u8
pub const fn compute_d2(bit_len: u16) -> u8
Computes d2 descriptor byte from cell length in bits
Sourcepub const fn reference_count(self) -> u8
pub const fn reference_count(self) -> u8
Computes child cell count.
Sourcepub const fn hash_count(self) -> u8
pub const fn hash_count(self) -> u8
Computes hash count.
NOTE: Guaranteed to be in range 1..=4.
Sourcepub const fn is_pruned_branch(self) -> bool
pub const fn is_pruned_branch(self) -> bool
Returns whether this cell is a pruned branch cell
Sourcepub const fn is_merkle(self) -> bool
pub const fn is_merkle(self) -> bool
Returns whether this cell type is Merkle proof or Merkle update.
Sourcepub const fn store_hashes(self) -> bool
pub const fn store_hashes(self) -> bool
Returns whether this cell should store hashes in data.
Sourcepub const fn level_mask(self) -> LevelMask
pub const fn level_mask(self) -> LevelMask
Computes level mask.
Sourcepub const fn is_aligned(self) -> bool
pub const fn is_aligned(self) -> bool
Returns whether this cell’s data is 8-bit aligned.
Trait Implementations§
Source§impl Clone for CellDescriptor
impl Clone for CellDescriptor
Source§fn clone(&self) -> CellDescriptor
fn clone(&self) -> CellDescriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CellDescriptor
impl Debug for CellDescriptor
Source§impl Hash for CellDescriptor
impl Hash for CellDescriptor
impl Copy for CellDescriptor
Auto Trait Implementations§
impl Freeze for CellDescriptor
impl RefUnwindSafe for CellDescriptor
impl Send for CellDescriptor
impl Sync for CellDescriptor
impl Unpin for CellDescriptor
impl UnwindSafe for CellDescriptor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)