Struct everscale_types::cell::CellBuilder
source · pub struct CellBuilder<C: CellFamily> { /* private fields */ }Expand description
Builder for constructing cells with densely packed data.
Implementations§
source§impl<C: CellFamily> CellBuilder<C>
impl<C: CellFamily> CellBuilder<C>
sourcepub fn from_raw_data(value: &[u8], bits: u16) -> Option<Self>
pub fn from_raw_data(value: &[u8], bits: u16) -> Option<Self>
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 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 with_level_mask(self, level_mask: LevelMask) -> Self
pub fn with_level_mask(self, level_mask: LevelMask) -> Self
Explicitly sets the level mask.
sourcepub fn set_level_mask(&mut self, level_mask: LevelMask)
pub fn set_level_mask(&mut self, level_mask: LevelMask)
Explicitly sets the level mask.
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 store_zeros(&mut self, bits: u16) -> bool
pub fn store_zeros(&mut self, bits: u16) -> bool
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) -> bool
pub fn store_bit_zero(&mut self) -> bool
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) -> bool
pub fn store_bit_one(&mut self) -> bool
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) -> bool
pub fn store_bit(&mut self, value: bool) -> bool
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) -> bool
pub fn store_u8(&mut self, value: u8) -> bool
Tries to store u8 in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn store_u16(&mut self, value: u16) -> bool
pub fn store_u16(&mut self, value: u16) -> bool
Tries to store u16 in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn store_u32(&mut self, value: u32) -> bool
pub fn store_u32(&mut self, value: u32) -> bool
Tries to store u32 in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn store_u64(&mut self, value: u64) -> bool
pub fn store_u64(&mut self, value: u64) -> bool
Tries to store u64 in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn store_u128(&mut self, value: u128) -> bool
pub fn store_u128(&mut self, value: u128) -> bool
Tries to store u128 in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn store_u256(&mut self, value: &[u8; 32]) -> bool
pub fn store_u256(&mut self, value: &[u8; 32]) -> bool
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) -> bool
pub fn store_small_uint(&mut self, value: u8, bits: u16) -> bool
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) -> bool
pub fn store_uint(&mut self, value: u64, bits: u16) -> bool
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) -> bool
pub fn store_raw(&mut self, value: &[u8], bits: u16) -> bool
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_slice_data<C1: CellFamily>(
&mut self,
value: &CellSlice<'_, C1>
) -> bool
pub fn store_slice_data<C1: CellFamily>(
&mut self,
value: &CellSlice<'_, C1>
) -> bool
Tries to store the remaining slice data in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn prepend_raw(&mut self, value: &[u8], bits: u16) -> bool
pub fn prepend_raw(&mut self, value: &[u8], bits: u16) -> bool
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).
source§impl<C: CellFamily> CellBuilder<C>
impl<C: CellFamily> CellBuilder<C>
sourcepub fn compute_level(&self) -> u8
pub fn compute_level(&self) -> u8
Computes the cell level from the level mask.
pub fn compute_level_mask(&self) -> LevelMask
sourcepub fn references(&self) -> &[CellContainer<C>]
pub fn references(&self) -> &[CellContainer<C>]
Returns a slice of the child cells stored in the builder.
sourcepub fn store_reference(&mut self, cell: CellContainer<C>) -> bool
pub fn store_reference(&mut self, cell: CellContainer<C>) -> bool
Tries to store a child in the cell,
returning false if there is not enough remaining capacity.
sourcepub fn store_builder(&mut self, builder: &Self) -> bool
pub fn store_builder(&mut self, builder: &Self) -> bool
Tries to append a builder (its data and references),
returning false if there is not enough remaining capacity.
sourcepub fn store_slice<'a>(&mut self, value: &CellSlice<'a, C>) -> bool
pub fn store_slice<'a>(&mut self, value: &CellSlice<'a, C>) -> bool
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<C>
) -> Option<CellContainer<C>>
pub fn build_ext(
self,
finalizer: &mut dyn Finalizer<C>
) -> Option<CellContainer<C>>
Tries to build a new cell using the specified finalizer.
source§impl<C> CellBuilder<C>where
for<'a> C: DefaultFinalizer + 'a,
impl<C> CellBuilder<C>where
for<'a> C: DefaultFinalizer + 'a,
sourcepub fn build(self) -> Option<CellContainer<C>>
pub fn build(self) -> Option<CellContainer<C>>
Tries to build a new cell using the default finalizer.