Type Alias DynCell

Source
pub type DynCell = dyn CellImpl + Send + Sync;
Expand description

Dyn trait type alias.

Implementations§

Source§

impl DynCell

Source

pub fn cell_type(&self) -> CellType

Computes cell type from descriptor bytes.

Source

pub fn level(&self) -> u8

Computes the cell level from the level mask.

Source

pub fn level_mask(&self) -> LevelMask

Computes the level mask from the descriptor bytes.

Source

pub fn reference_count(&self) -> u8

Computes the number of child cells from descriptor bytes.

Source

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.

Source

pub fn is_exotic(&self) -> bool

Returns whether the cell is not Ordinary.

Source

pub fn repr_hash(&self) -> &HashBytes

Returns a representation hash of the cell.

Source

pub fn repr_depth(&self) -> u16

Returns a representation depth of the cell.

Source

pub fn has_max_depth(&self) -> bool

Returns true if any of cell levels has the maximum depth.

Source

pub fn is_empty(&self) -> bool

Returns true if the cell is empty (no bits, no refs).

Source

pub fn references(&self) -> RefsIter<'_>

Creates an iterator through child nodes.

Source

pub fn as_slice(&self) -> Result<CellSlice<'_>, Error>

Returns this cell as a cell slice. Returns an error if the cell is not ordinary.

Source

pub fn as_slice_allow_exotic(&self) -> CellSlice<'_>

Returns this cell as a cell slice.

Loads cell as is.

Source

pub fn compute_unique_stats(&self, limit: usize) -> Option<CellTreeStats>

Recursively computes the count of distinct cells returning the total storage used by this dag taking into account the identification of equal cells.

Source

pub fn touch_recursive(&self)

Recursively traverses the cells tree without tracking a uniqueness of cells. Usefull for adding small subtrees to merkle proofs.

Source

pub fn debug_root(&self) -> DebugCell<'_>

Returns an object that implements Debug for printing only the root cell of the cell tree.

Source

pub fn display_root(&self) -> DisplayCellRoot<'_>

Returns an object that implements Display for printing only the root cell of the cell tree.

Source

pub fn display_tree(&self) -> DisplayCellTree<'_>

Returns an object that implements Display for printing all cells in the cell tree.

Source

pub fn display_data(&self) -> impl Display + Binary + '_

Returns an object which will display cell data as a bitstring with a termination bit.

Source

pub fn parse<'a, T: Load<'a>>(&'a self) -> Result<T, Error>

Converts this cell into a slice and tries to load the specified type from it. Fails if the cell is not ordinary.

NOTE: parsing Cell will load the first reference!

Source

pub fn parse_exotic<'a, T: LoadCell<'a>>(&'a self) -> Result<T, Error>

Loads an exotic cell.

Trait Implementations§

Source§

impl AsMut<dyn CellImpl + Sync + Send> for DynCell

Source§

fn as_mut(&mut self) -> &mut Self

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<dyn CellImpl + Sync + Send> for DynCell

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for DynCell

Source§

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

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

impl ExactSize for DynCell

Source§

fn exact_size(&self) -> Size

Exact size of the value when it is stored in a slice.
Source§

impl<'a> Load<'a> for &'a DynCell

Source§

fn load_from(slice: &mut CellSlice<'a>) -> Result<Self, Error>

Tries to load itself from a cell slice.
Source§

impl PartialEq for DynCell

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DynCell

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for DynCell