pub struct CellDataBuilder { /* private fields */ }
Expand description
Builder for constructing cell data.
Implementations§
Source§impl CellDataBuilder
impl CellDataBuilder
Sourcepub fn from_raw_data(value: &[u8], bits: u16) -> Result<Self, Error>
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).
Sourcepub fn as_data_slice(&self) -> CellSlice<'_>
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.
Sourcepub fn display_data(&self) -> DisplayCellBuilderData<'_>
pub fn display_data(&self) -> DisplayCellBuilderData<'_>
Returns an object which will display data as a bitstring with a termination bit.
Sourcepub fn as_bitstring(&self) -> Bitstring<'_>
pub fn as_bitstring(&self) -> Bitstring<'_>
Returns cell data as a Bitstring
.
Sourcepub const fn spare_capacity_bits(&self) -> u16
pub const fn spare_capacity_bits(&self) -> u16
Returns remaining data capacity in bits.
Sourcepub const fn has_capacity_bits(&self, bits: u16) -> bool
pub const fn has_capacity_bits(&self, bits: u16) -> bool
Returns true if there is enough remaining capacity to fit bits
.
Sourcepub fn clear_bits(&mut self)
pub fn clear_bits(&mut self)
Clears all data bits and sets the size in bits to 0.
Sourcepub fn rewind_bits(&mut self, bits: u16) -> Result<(), Error>
pub fn rewind_bits(&mut self, bits: u16) -> Result<(), Error>
Removes the specified amount of bits from the end of the data.
Sourcepub fn store_zeros(&mut self, bits: u16) -> Result<(), Error>
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.
Sourcepub fn store_ones(&mut self, bits: u16) -> Result<(), Error>
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.
Sourcepub fn store_bit_zero(&mut self) -> Result<(), Error>
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.
Sourcepub fn store_bit_one(&mut self) -> Result<(), Error>
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.
Sourcepub fn store_bit(&mut self, value: bool) -> Result<(), Error>
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.
Sourcepub fn store_u8(&mut self, value: u8) -> Result<(), Error>
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.
Sourcepub fn store_u16(&mut self, value: u16) -> Result<(), Error>
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.
Sourcepub fn store_u32(&mut self, value: u32) -> Result<(), Error>
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.
Sourcepub fn store_u64(&mut self, value: u64) -> Result<(), Error>
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.
Sourcepub fn store_u128(&mut self, value: u128) -> Result<(), Error>
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.
Sourcepub fn store_u256<T>(&mut self, value: &T) -> Result<(), Error>
pub fn store_u256<T>(&mut self, value: &T) -> Result<(), Error>
Tries to store 32 bytes in the cell,
returning false
if there is not enough remaining capacity.
Sourcepub fn store_small_uint(&mut self, value: u8, bits: u16) -> Result<(), Error>
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).
Sourcepub fn store_uint(&mut self, value: u64, bits: u16) -> Result<(), Error>
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).
Sourcepub fn store_bigint(
&mut self,
x: &BigInt,
bits: u16,
signed: bool,
) -> Result<(), Error>
pub fn store_bigint( &mut self, x: &BigInt, bits: u16, signed: bool, ) -> Result<(), Error>
Stores bits
-width [BigInt
] to the builder.
Sourcepub fn store_bigint_truncate(
&mut self,
x: &BigInt,
bits: u16,
signed: bool,
) -> Result<(), Error>
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.
Sourcepub fn store_biguint(
&mut self,
x: &BigUint,
bits: u16,
signed: bool,
) -> Result<(), Error>
pub fn store_biguint( &mut self, x: &BigUint, bits: u16, signed: bool, ) -> Result<(), Error>
Stores bits
-width [BigUint
] to the builder.
Sourcepub fn store_biguint_truncate(
&mut self,
x: &BigUint,
bits: u16,
) -> Result<(), Error>
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.
Sourcepub fn store_var_bigint(
&mut self,
x: &BigInt,
len_bits: u16,
signed: bool,
) -> Result<(), Error>
pub fn store_var_bigint( &mut self, x: &BigInt, len_bits: u16, signed: bool, ) -> Result<(), Error>
Loads variable length [BigInt
] to the builder.
Sourcepub fn store_var_biguint(
&mut self,
x: &BigUint,
len_bits: u16,
) -> Result<(), Error>
pub fn store_var_biguint( &mut self, x: &BigUint, len_bits: u16, ) -> Result<(), Error>
Loads variable length [BigInt
] to the builder.
Sourcepub fn store_raw(&mut self, value: &[u8], bits: u16) -> Result<(), Error>
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).
Sourcepub fn store_cell_data<T>(&mut self, value: T) -> Result<(), Error>
pub fn store_cell_data<T>(&mut self, value: T) -> Result<(), Error>
Tries to store all data bits of the specified cell in the current cell,
returning false
if there is not enough remaining capacity.
Sourcepub fn store_slice_data<'a, T>(&mut self, value: T) -> Result<(), Error>
pub fn store_slice_data<'a, T>(&mut self, value: T) -> Result<(), Error>
Tries to store the remaining slice data in the cell,
returning false
if there is not enough remaining capacity.
Trait Implementations§
Source§impl AsMut<CellDataBuilder> for CellBuilder
impl AsMut<CellDataBuilder> for CellBuilder
Source§fn as_mut(&mut self) -> &mut CellDataBuilder
fn as_mut(&mut self) -> &mut CellDataBuilder
Source§impl AsRef<CellDataBuilder> for CellBuilder
impl AsRef<CellDataBuilder> for CellBuilder
Source§fn as_ref(&self) -> &CellDataBuilder
fn as_ref(&self) -> &CellDataBuilder
Source§impl Clone for CellDataBuilder
impl Clone for CellDataBuilder
Source§fn clone(&self) -> CellDataBuilder
fn clone(&self) -> CellDataBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CellDataBuilder
impl Debug for CellDataBuilder
Source§impl Default for CellDataBuilder
impl Default for CellDataBuilder
Source§impl From<CellDataBuilder> for CellBuilder
impl From<CellDataBuilder> for CellBuilder
Source§fn from(inner: CellDataBuilder) -> Self
fn from(inner: CellDataBuilder) -> Self
Source§impl Ord for CellDataBuilder
impl Ord for CellDataBuilder
Source§impl PartialEq for CellDataBuilder
impl PartialEq for CellDataBuilder
Source§impl PartialOrd for CellDataBuilder
impl PartialOrd for CellDataBuilder
impl Eq for CellDataBuilder
Auto Trait Implementations§
impl Freeze for CellDataBuilder
impl RefUnwindSafe for CellDataBuilder
impl Send for CellDataBuilder
impl Sync for CellDataBuilder
impl Unpin for CellDataBuilder
impl UnwindSafe for CellDataBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self
to key
and returns true
if they are equal.