Struct everscale_types::cell::CellBuilder
source · pub struct CellBuilder { /* private fields */ }Expand description
Builder for constructing cells with densely packed data.
Implementations§
source§impl CellBuilder
impl CellBuilder
sourcepub fn build_from<T>(data: T) -> Result<Cell, Error>where
T: Store,
pub fn build_from<T>(data: T) -> Result<Cell, Error>where T: Store,
Builds a new cell from the specified data using the default finalizer.
sourcepub fn build_from_ext<T>(
data: T,
finalizer: &mut dyn Finalizer
) -> Result<Cell, Error>where
T: Store,
pub fn build_from_ext<T>( data: T, finalizer: &mut dyn Finalizer ) -> Result<Cell, Error>where T: Store,
Builds a new cell from the specified data using the provided finalizer.
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 as_full_slice(&self) -> CellSlice<'_>
pub fn as_full_slice(&self) -> CellSlice<'_>
Returns a slice which contains builder data and references.
NOTE: intermediate cell hash is undefined.
sourcepub fn spare_bits_capacity(&self) -> u16
pub fn spare_bits_capacity(&self) -> u16
Returns remaining data capacity in bits.
sourcepub fn spare_refs_capacity(&self) -> u8
pub fn spare_refs_capacity(&self) -> u8
Returns remaining references capacity.
sourcepub fn has_capacity(&self, bits: u16, refs: u8) -> bool
pub fn has_capacity(&self, bits: u16, refs: u8) -> bool
Returns true if there is enough remaining capacity to fit bits and refs.
sourcepub fn set_exotic(&mut self, is_exotic: bool)
pub fn set_exotic(&mut self, is_exotic: bool)
Marks this cell as exotic.
sourcepub fn rewind(&mut self, bits: u16) -> Result<(), Error>
pub fn rewind(&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_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(&mut self, value: &HashBytes) -> Result<(), Error>
pub fn store_u256(&mut self, value: &HashBytes) -> 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_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>where
T: AsRef<DynCell>,
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§impl CellBuilder
impl CellBuilder
sourcepub fn references(&self) -> &[Cell]
pub fn references(&self) -> &[Cell]
Returns a slice of the child cells stored in the builder.
sourcepub fn store_reference(&mut self, cell: Cell) -> Result<(), Error>
pub fn store_reference(&mut self, cell: Cell) -> Result<(), Error>
Tries to store a child in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn set_references(&mut self, refs: CellRefsBuilder)
pub fn set_references(&mut self, refs: CellRefsBuilder)
Sets children of the cell.
sourcepub fn store_builder(&mut self, builder: &Self) -> Result<(), Error>
pub fn store_builder(&mut self, builder: &Self) -> Result<(), Error>
Tries to append a builder (its data and references),
returning false if there is not enough remaining capacity.
sourcepub fn store_slice<'a, T>(&mut self, value: T) -> Result<(), Error>where
T: AsRef<CellSlice<'a>>,
pub fn store_slice<'a, T>(&mut self, value: T) -> Result<(), Error>where T: AsRef<CellSlice<'a>>,
Tries to append a cell slice (its data and references),
returning false if there is not enough remaining capacity.
sourcepub fn build_ext(self, finalizer: &mut dyn Finalizer) -> Result<Cell, Error>
pub fn build_ext(self, finalizer: &mut dyn Finalizer) -> Result<Cell, Error>
Tries to build a new cell using the specified finalizer.
sourcepub fn build(self) -> Result<Cell, Error>
pub fn build(self) -> Result<Cell, Error>
Tries to build a new cell using the default finalizer.
sourcepub fn display_data(&self) -> impl Display + Binary + '_
pub fn display_data(&self) -> impl Display + Binary + '_
Returns an object which will display data as a bitstring with a termination bit.
Trait Implementations§
source§impl Clone for CellBuilder
impl Clone for CellBuilder
source§impl Debug for CellBuilder
impl Debug for CellBuilder
source§impl Default for CellBuilder
impl Default for CellBuilder
source§impl Ord for CellBuilder
impl Ord for CellBuilder
source§impl PartialEq<CellBuilder> for CellBuilder
impl PartialEq<CellBuilder> for CellBuilder
source§impl PartialOrd<CellBuilder> for CellBuilder
impl PartialOrd<CellBuilder> for CellBuilder
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more