Trait everscale_types::cell::Cell
source · pub trait Cell<C: CellFamily> {
// Required methods
fn descriptor(&self) -> CellDescriptor;
fn data(&self) -> &[u8] ⓘ;
fn bit_len(&self) -> u16;
fn reference(&self, index: u8) -> Option<&dyn Cell<C>>;
fn reference_cloned(&self, index: u8) -> Option<CellContainer<C>>;
fn virtualize(&self) -> &dyn Cell<C>;
fn hash(&self, level: u8) -> &CellHash;
fn depth(&self, level: u8) -> u16;
}Expand description
Represents the interface of a well-formed cell.
Since all basic operations are implements via dynamic dispatch,
all high-level helper methods are implemented for dyn Cell.
Required Methods§
sourcefn descriptor(&self) -> CellDescriptor
fn descriptor(&self) -> CellDescriptor
Returns cell descriptor.
See also
Cell descriptor contains some tightly packed info about the cell.
If you want convenient methods to access it use:
cell_type, level_mask, reference_count, is_exotic
sourcefn reference(&self, index: u8) -> Option<&dyn Cell<C>>
fn reference(&self, index: u8) -> Option<&dyn Cell<C>>
Returns a reference to the Nth child cell.
sourcefn reference_cloned(&self, index: u8) -> Option<CellContainer<C>>
fn reference_cloned(&self, index: u8) -> Option<CellContainer<C>>
Returns the Nth child cell.
sourcefn virtualize(&self) -> &dyn Cell<C>
fn virtualize(&self) -> &dyn Cell<C>
Returns this cell as a virtualized cell, so that all hashes and depths will have an offset.
sourcefn hash(&self, level: u8) -> &CellHash
fn hash(&self, level: u8) -> &CellHash
Returns cell hash for the specified level.
Cell representation hash is the hash at the maximum level (LevelMask::MAX_LEVEL).
Use repr_hash as a simple alias for this.
Implementations§
source§impl<C: CellFamily> dyn Cell<C> + '_
impl<C: CellFamily> dyn Cell<C> + '_
sourcepub fn level_mask(&self) -> LevelMask
pub fn level_mask(&self) -> LevelMask
Computes the level mask from the descriptor bytes.
sourcepub fn reference_count(&self) -> u8
pub fn reference_count(&self) -> u8
Computes the number of child cells from descriptor bytes.
sourcepub fn repr_depth(&self) -> u16
pub fn repr_depth(&self) -> u16
Returns a representation depth of the cell.
sourcepub fn references(&self) -> RefsIter<'_, C> ⓘ
pub fn references(&self) -> RefsIter<'_, C> ⓘ
Creates an iterator through child nodes.
sourcepub fn debug_root(&self) -> DebugCell<'_, C>
pub fn debug_root(&self) -> DebugCell<'_, C>
Returns an object that implements Debug for printing only
the root cell of the cell tree.
sourcepub fn display_root(&self) -> DisplayCellRoot<'_, C>
pub fn display_root(&self) -> DisplayCellRoot<'_, C>
Returns an object that implements Display for printing only
the root cell of the cell tree.
sourcepub fn display_tree(&self) -> DisplayCellTree<'_, C>
pub fn display_tree(&self) -> DisplayCellTree<'_, C>
Returns an object that implements Display for printing all
cells in the cell tree.