pub trait Cell<C: CellFamily> {
    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;
    fn stats(&self) -> CellTreeStats;
}
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§

Returns cell descriptor.

See also

Cell descriptor contains some tightly packed info about the cell. If you want convinient methods to access it use: cell_type, level_mask, reference_count, is_exotic

Returns the raw data of this cell.

Returns the data size of this cell in bits.

Returns a reference to the Nth child cell.

Returns the Nth child cell.

Returns this cell as a virtualized cell, so that all hashes and depths will have an offset.

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.

Returns cell depth for the specified level.

Returns the sum of all bits and cells of all elements in the cell tree (including this cell).

Implementations§

Computes cell type from descriptor bytes.

Computes the cell level from the level mask.

Computes the level mask from the descriptor bytes.

Computes the number of child cells from descriptor bytes.

Returns whether the cell is not Ordinary.

Returns a representation hash of the cell.

Returns a representation depth of the cell.

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

Creates an iterator through child nodes.

Returns this cell as a cell slice.

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

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

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

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§