Trait everscale_types::cell::CellImpl
source · pub trait CellImpl {
// Required methods
fn descriptor(&self) -> CellDescriptor;
fn data(&self) -> &[u8] ⓘ;
fn bit_len(&self) -> u16;
fn reference(&self, index: u8) -> Option<&DynCell>;
fn reference_cloned(&self, index: u8) -> Option<Cell>;
fn virtualize(&self) -> &DynCell;
fn hash(&self, level: u8) -> &CellHash;
fn depth(&self, level: u8) -> u16;
fn take_first_child(&mut self) -> Option<Cell>;
fn replace_first_child(&mut self, parent: Cell) -> Result<Cell, Cell>;
fn take_next_child(&mut self) -> Option<Cell>;
}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_cloned(&self, index: u8) -> Option<Cell>
fn reference_cloned(&self, index: u8) -> Option<Cell>
Returns the Nth child cell.
sourcefn virtualize(&self) -> &DynCell
fn virtualize(&self) -> &DynCell
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.
sourcefn take_first_child(&mut self) -> Option<Cell>
fn take_first_child(&mut self) -> Option<Cell>
Consumes the first child during the deep drop.
sourcefn replace_first_child(&mut self, parent: Cell) -> Result<Cell, Cell>
fn replace_first_child(&mut self, parent: Cell) -> Result<Cell, Cell>
Replaces the first child with the provided parent during the deep drop.
Returns Ok(child) if child was successfully replaced,
Err(parent) otherwise.
sourcefn take_next_child(&mut self) -> Option<Cell>
fn take_next_child(&mut self) -> Option<Cell>
Consumes the next child (except first) during the deep drop.
Implementations§
source§impl dyn CellImpl + Sync + Send + 'static
impl dyn CellImpl + Sync + Send + 'static
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 get_reference_as_slice(&self, index: u8) -> Result<CellSlice<'_>, Error>
pub fn get_reference_as_slice(&self, index: u8) -> Result<CellSlice<'_>, Error>
Tries to load the specified child cell as slice. Returns an error if the loaded cell is absent or is pruned.
sourcepub fn repr_depth(&self) -> u16
pub fn repr_depth(&self) -> u16
Returns a representation depth of the cell.
sourcepub fn references(&self) -> RefsIter<'_> ⓘ
pub fn references(&self) -> RefsIter<'_> ⓘ
Creates an iterator through child nodes.
sourcepub fn debug_root(&self) -> DebugCell<'_>
pub fn debug_root(&self) -> DebugCell<'_>
Returns an object that implements Debug for printing only
the root cell of the cell tree.
sourcepub fn display_root(&self) -> DisplayCellRoot<'_>
pub fn display_root(&self) -> DisplayCellRoot<'_>
Returns an object that implements Display for printing only
the root cell of the cell tree.
sourcepub fn display_tree(&self) -> DisplayCellTree<'_>
pub fn display_tree(&self) -> DisplayCellTree<'_>
Returns an object that implements Display for printing all
cells in the cell tree.