Struct CellDataBuilder

Source
pub struct CellDataBuilder { /* private fields */ }
Expand description

Builder for constructing cell data.

Implementations§

Source§

impl CellDataBuilder

Source

pub const fn new() -> Self

Creates an empty cell data builder.

Source

pub fn from_raw_data(value: &[u8], bits: u16) -> Result<Self, Error>

Tries to create a cell builder with the specified data.

NOTE: if bits is greater than bytes * 8, pads the value with zeros (as high bits).

Source

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

Returns a slice which contains only builder data bits and no references.

NOTE: intermediate cell hash is undefined.

Source

pub fn display_data(&self) -> DisplayCellBuilderData<'_>

Returns an object which will display data as a bitstring with a termination bit.

Source

pub fn as_bitstring(&self) -> Bitstring<'_>

Returns cell data as a Bitstring.

Source

pub const fn raw_data(&self) -> &[u8; 128]

Returns an underlying cell data.

Source

pub const fn size_bits(&self) -> u16

Returns the data size of this cell in bits.

Source

pub const fn spare_capacity_bits(&self) -> u16

Returns remaining data capacity in bits.

Source

pub const fn has_capacity_bits(&self, bits: u16) -> bool

Returns true if there is enough remaining capacity to fit bits.

Source

pub fn clear_bits(&mut self)

Clears all data bits and sets the size in bits to 0.

Source

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

Removes the specified amount of bits from the end of the data.

Source

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

Tries to store the specified number of zero bits in the cell, returning false if there is not enough remaining capacity.

Source

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

Tries to store the specified number of set bits in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_bit_zero(&mut self) -> Result<(), Error>

Tries to store one zero bit in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_bit_one(&mut self) -> Result<(), Error>

Tries to store one non-zero bit in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_bit(&mut self, value: bool) -> Result<(), Error>

Tries to store one bit in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_u8(&mut self, value: u8) -> Result<(), Error>

Tries to store u8 in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_u16(&mut self, value: u16) -> Result<(), Error>

Tries to store u16 in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_u32(&mut self, value: u32) -> Result<(), Error>

Tries to store u32 in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_u64(&mut self, value: u64) -> Result<(), Error>

Tries to store u64 in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_u128(&mut self, value: u128) -> Result<(), Error>

Tries to store u128 in the cell, returning false if there is not enough remaining capacity.

Source

pub fn store_u256<T>(&mut self, value: &T) -> Result<(), Error>
where T: AsRef<[u8; 32]>,

Tries to store 32 bytes in the cell, returning false if there is not enough remaining capacity.

Source

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

Tries to store u8 in the cell (but only the specified number of bits), returning false if there is not enough remaining capacity.

NOTE: if bits is greater than 8, pads the value with zeros (as high bits).

Source

pub fn store_uint(&mut self, value: u64, bits: u16) -> Result<(), Error>

Tries to store u64 in the cell (but only the specified number of bits), returning false if there is not enough remaining capacity.

NOTE: if bits is greater than 64, pads the value with zeros (as high bits).

Source

pub fn store_bigint( &mut self, x: &BigInt, bits: u16, signed: bool, ) -> Result<(), Error>

Stores bits-width [BigInt] to the builder.

Source

pub fn store_bigint_truncate( &mut self, x: &BigInt, bits: u16, signed: bool, ) -> Result<(), Error>

Stores bits-width [BigInt] to the builder. x bit size is ignored and only low bits of it are written.

Source

pub fn store_biguint( &mut self, x: &BigUint, bits: u16, signed: bool, ) -> Result<(), Error>

Stores bits-width [BigUint] to the builder.

Source

pub fn store_biguint_truncate( &mut self, x: &BigUint, bits: u16, ) -> Result<(), Error>

Stores bits-width [BigUint] to the builder. x bit size is ignored and only low bits of it are written.

Source

pub fn store_var_bigint( &mut self, x: &BigInt, len_bits: u16, signed: bool, ) -> Result<(), Error>

Loads variable length [BigInt] to the builder.

Source

pub fn store_var_biguint( &mut self, x: &BigUint, len_bits: u16, ) -> Result<(), Error>

Loads variable length [BigInt] to the builder.

Source

pub fn store_raw(&mut self, value: &[u8], bits: u16) -> Result<(), Error>

Tries to store bytes in the cell (but only the specified number of bits), returning false if there is not enough remaining capacity.

NOTE: if bits is greater than bytes * 8, pads the value with zeros (as high bits).

Source

pub fn store_cell_data<T>(&mut self, value: T) -> Result<(), Error>
where T: AsRef<DynCell>,

Tries to store all data bits of the specified cell in the current cell, returning false if there is not enough remaining capacity.

Source

pub fn store_slice_data<'a, T>(&mut self, value: T) -> Result<(), Error>
where T: AsRef<CellSlice<'a>>,

Tries to store the remaining slice data in the cell, returning false if there is not enough remaining capacity.

Source

pub fn prepend_raw(&mut self, value: &[u8], bits: u16) -> Result<(), Error>

Tries to prepend bytes to the cell data (but only the specified number of bits), returning false if there is not enough capacity.

NOTE: if bits is greater than bytes * 8, pads the value with zeros (as high bits).

Trait Implementations§

Source§

impl AsMut<CellDataBuilder> for CellBuilder

Source§

fn as_mut(&mut self) -> &mut CellDataBuilder

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

impl AsRef<CellDataBuilder> for CellBuilder

Source§

fn as_ref(&self) -> &CellDataBuilder

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

impl Clone for CellDataBuilder

Source§

fn clone(&self) -> CellDataBuilder

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 CellDataBuilder

Source§

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

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

impl Default for CellDataBuilder

Source§

fn default() -> Self

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

impl From<CellDataBuilder> for CellBuilder

Source§

fn from(inner: CellDataBuilder) -> Self

Converts to this type from the input type.
Source§

impl Ord for CellDataBuilder

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for CellDataBuilder

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 PartialOrd for CellDataBuilder

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for CellDataBuilder

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> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compares self to key and returns their ordering.
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<T> EquivalentRepr<T> for T