Struct everscale_types::cell::CellSliceRange
source · pub struct CellSliceRange { /* private fields */ }Expand description
Indices of the slice data and refs windows.
Implementations§
source§impl CellSliceRange
impl CellSliceRange
sourcepub fn apply<T>(self, cell: &T) -> Result<CellSlice<'_>, Error>where
T: AsRef<DynCell> + ?Sized,
pub fn apply<T>(self, cell: &T) -> Result<CellSlice<'_>, Error>where T: AsRef<DynCell> + ?Sized,
Constructs a new cell slice from the specified cell using the current range. Returns an error if the cell is pruned.
NOTE: the resulting range will be truncated to cell bounds.
sourcepub unsafe fn apply_unchecked<T>(self, cell: &T) -> CellSlice<'_>where
T: AsRef<DynCell> + ?Sized,
pub unsafe fn apply_unchecked<T>(self, cell: &T) -> CellSlice<'_>where T: AsRef<DynCell> + ?Sized,
Constructs a new cell slice from the specified cell using the current range.
NOTE: the resulting range will be truncated to cell bounds.
Safety
The following must be true:
- cell is not pruned
- range is in cell bounds
sourcepub const fn remaining_bits(&self) -> u16
pub const fn remaining_bits(&self) -> u16
Returns the number of remaining bits of data in the slice.
sourcepub const fn remaining_refs(&self) -> u8
pub const fn remaining_refs(&self) -> u8
Returns the number of remaining references in the slice.
sourcepub const fn is_data_empty(&self) -> bool
pub const fn is_data_empty(&self) -> bool
Returns whether there are no bits of data left.
sourcepub const fn is_refs_empty(&self) -> bool
pub const fn is_refs_empty(&self) -> bool
Returns whether there are no references left.
sourcepub const fn bits_offset(&self) -> u16
pub const fn bits_offset(&self) -> u16
Returns the start of the data window.
sourcepub const fn refs_offset(&self) -> u8
pub const fn refs_offset(&self) -> u8
Returns the start of the references window.
sourcepub const fn has_remaining(&self, bits: u16, refs: u8) -> bool
pub const fn has_remaining(&self, bits: u16, refs: u8) -> bool
Returns true if the slice contains at least bits and refs.
sourcepub fn try_advance(&mut self, bits: u16, refs: u8) -> bool
pub fn try_advance(&mut self, bits: u16, refs: u8) -> bool
Tries to advance the start of data and refs windows,
returns false if bits or refs are greater than the remainder.
sourcepub fn get_prefix(&self, bits: u16, refs: u8) -> Self
pub fn get_prefix(&self, bits: u16, refs: u8) -> Self
Returns a slice range starting at the same bits and refs offsets,
and containing no more than bits of data and refs of children.
Trait Implementations§
source§impl Clone for CellSliceRange
impl Clone for CellSliceRange
source§fn clone(&self) -> CellSliceRange
fn clone(&self) -> CellSliceRange
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for CellSliceRange
impl Debug for CellSliceRange
source§impl PartialEq<CellSliceRange> for CellSliceRange
impl PartialEq<CellSliceRange> for CellSliceRange
source§fn eq(&self, other: &CellSliceRange) -> bool
fn eq(&self, other: &CellSliceRange) -> bool
self and other values to be equal, and is used
by ==.