CellSliceRange

Struct CellSliceRange 

Source
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> + ?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.

Source

pub fn apply_allow_special<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
Source

pub const fn size(&self) -> Size

Returns the number of remaining bits and refs in the slice.

Source

pub const fn size_bits(&self) -> u16

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

Source

pub const fn size_refs(&self) -> u8

Returns the number of remaining references in the slice.

Source

pub const fn is_empty(&self) -> bool

Returns whether there are no data bits and refs left.

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 offset(&self) -> Size

Returns the start of data and reference windows.

Source

pub const fn offset_bits(&self) -> u16

Returns the start of the data window.

Source

pub const fn offset_refs(&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 skip_first(&mut self, bits: u16, refs: u8) -> Result<(), Error>

Tries to advance the start of data and refs windows.

Source

pub fn only_first(&mut self, bits: u16, refs: u8) -> Result<(), Error>

Leaves only the first bits and refs in the slice.

Source

pub fn skip_last(&mut self, bits: u16, refs: u8) -> Result<(), Error>

Removes the last bits and refs from the slice.

Source

pub fn only_last(&mut self, bits: u16, refs: u8) -> Result<(), Error>

Leaves only the last bits and refs in the slice.

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.

Source

pub fn is_full(&self, cell: &DynCell) -> bool

Returns whether this range has the same size as the cell.

Trait Implementations§

Source§

impl Clone for CellSliceRange

Source§

fn clone(&self) -> CellSliceRange

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 CellSliceRange

Source§

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

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

impl Default for CellSliceRange

Source§

fn default() -> CellSliceRange

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

impl PartialEq for CellSliceRange

Source§

fn eq(&self, other: &CellSliceRange) -> 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 Copy for CellSliceRange

Source§

impl Eq for CellSliceRange

Source§

impl StructuralPartialEq for CellSliceRange

Auto Trait Implementations§

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