Cell

Struct Cell 

Source
pub struct Cell(/* private fields */);
Expand description

Thread-safe cell.

Implementations§

Source§

impl Cell

Source

pub fn untrack(self) -> Self

Unwraps the root cell from the usage tracking.

Source

pub fn downgrade(this: &Cell) -> WeakCell

Creates a new WeakCell reference to this cell.

Methods from Deref<Target = 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 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 pruned.

Source

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

Returns this cell as a cell slice.

§Safety

The following must be true:

  • cell is not pruned
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 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.

NOTE: parsing Cell will load the first reference!

Trait Implementations§

Source§

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

Source§

fn as_ref(&self) -> &DynCell

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

impl Borrow<dyn CellImpl + Send + Sync> for Cell

Source§

fn borrow(&self) -> &DynCell

Immutably borrows from an owned value. Read more
Source§

impl CellFamily for Cell

Source§

type EmptyCellContext = EmptyCellContext

The default cell context type.
Source§

fn empty_cell() -> Cell

Creates an empty cell. Read more
Source§

fn empty_cell_ref() -> &'static DynCell

Returns a static reference to the empty cell
Source§

fn empty_context() -> Self::EmptyCellContext

Creates an empty cell context.
Source§

fn all_zeros_ref() -> &'static DynCell

Returns a static reference to the cell with all zeros.
Source§

fn all_ones_ref() -> &'static DynCell

Returns a static reference to the cell with all ones.
Source§

fn virtualize(cell: Cell) -> Cell

Creates a virtualized cell from the specified cell.
Source§

impl Clone for Cell

Source§

fn clone(&self) -> Cell

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cell

Source§

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

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

impl Default for Cell

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for Cell

Source§

type Target = dyn CellImpl + Send + Sync

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl ExactSize for Cell

Source§

fn exact_size(&self) -> Size

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

impl<T: CellImpl + Send + Sync + 'static> From<Arc<T>> for Cell

Source§

fn from(value: CellInner<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<dyn CellImpl + Send + Sync>> for Cell

Source§

fn from(value: CellInner) -> Self

Converts to this type from the input type.
Source§

impl From<Cell> for CellInner

Source§

fn from(value: Cell) -> Self

Converts to this type from the input type.
Source§

impl FromAbi for Cell

Source§

fn from_abi(value: AbiValue) -> Result<Self>

Constructs self from the ABI value.
Source§

impl IntoAbi for Cell

Source§

fn as_abi(&self) -> AbiValue

Returns a corresponding ABI value. Read more
Source§

fn into_abi(self) -> AbiValue
where Self: Sized,

Converts into a corresponding ABI value.
Source§

impl<'a> Load<'a> for Cell

Source§

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

Tries to load itself from a cell slice.
Source§

impl PartialEq for Cell

Source§

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

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

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 Store for Cell

Source§

fn store_into( &self, builder: &mut CellBuilder, _: &mut dyn CellContext, ) -> Result<(), Error>

Tries to store itself into the cell builder.
Source§

impl TryAsMut<dyn CellImpl + Send + Sync> for Cell

Source§

fn try_as_mut(&mut self) -> Option<&mut DynCell>

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

impl WithAbiType for Cell

Source§

fn abi_type() -> AbiType

Returns a corresponding ABI type.
Source§

impl Eq for Cell

Auto Trait Implementations§

§

impl Freeze for Cell

§

impl !RefUnwindSafe for Cell

§

impl Send for Cell

§

impl Sync for Cell

§

impl Unpin for Cell

§

impl !UnwindSafe for Cell

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compares self to key and returns true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> EquivalentRepr<T> for T