pub struct CellSliceRange { /* private fields */ }
Expand description

Indices of the slice data and refs windows.

Implementations§

source§

impl CellSliceRange

source

pub const fn empty() -> Self

Returns an empty slice range.

source

pub fn full(cell: &DynCell) -> Self

Returns a full range for the specified cell.

source

pub fn apply<T>(self, cell: &T) -> Result<CellSlice<'_>, Error>where T: AsRef<DynCell>,

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.

source

pub unsafe fn apply_unchecked<T>(self, cell: &T) -> CellSlice<'_>where T: AsRef<DynCell>,

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
source

pub const fn remaining_bits(&self) -> u16

Returns the number of remaining bits of data in the slice.

source

pub const fn remaining_refs(&self) -> u8

Returns the number of remaining references in the slice.

source

pub const fn is_data_empty(&self) -> bool

Returns whether there are no bits of data left.

source

pub const fn is_refs_empty(&self) -> bool

Returns whether there are no references left.

source

pub const fn bits_offset(&self) -> u16

Returns the start of the data window.

source

pub const fn refs_offset(&self) -> u8

Returns the start of the references window.

source

pub const fn has_remaining(&self, bits: u16, refs: u8) -> bool

Returns true if the slice contains at least bits and refs.

source

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.

source

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

source§

fn clone(&self) -> CellSliceRange

Returns a copy 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 CellSliceRange

source§

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

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

impl PartialEq<CellSliceRange> for CellSliceRange

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for CellSliceRange

source§

impl Eq for CellSliceRange

source§

impl StructuralEq for CellSliceRange

source§

impl StructuralPartialEq for CellSliceRange

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V