pub struct BocHeader<'a, S = RandomState> { /* private fields */ }Expand description
Intermediate BOC serializer state.
Implementations§
Source§impl<'a, S> BocHeader<'a, S>where
S: BuildHasher + Default,
impl<'a, S> BocHeader<'a, S>where
S: BuildHasher + Default,
Sourcepub fn with_root(root: &'a DynCell) -> Self
pub fn with_root(root: &'a DynCell) -> Self
Creates an intermediate BOC serializer state with a single root.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an empty intermediate BOC serializer state. Reserves space for the specified number of cells.
Sourcepub fn with_capacity_and_root(capacity: usize, root: &'a DynCell) -> Self
pub fn with_capacity_and_root(capacity: usize, root: &'a DynCell) -> Self
Creates an intermediate BOC serializer state with a single root. Reserves space for the specified number of cells.
Source§impl<'a, S> BocHeader<'a, S>where
S: BuildHasher,
impl<'a, S> BocHeader<'a, S>where
S: BuildHasher,
Sourcepub fn with_root_and_cache(root: &'a DynCell, cache: BocHeaderCache<S>) -> Self
pub fn with_root_and_cache(root: &'a DynCell, cache: BocHeaderCache<S>) -> Self
Creates an intermediate BOC serializer state with a single root and preallocated revs cache.
Sourcepub fn into_cache(self) -> BocHeaderCache<S>
pub fn into_cache(self) -> BocHeaderCache<S>
Transforms BocHeader into reusable revs cache.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the header, removing all cells. Keeps the allocated memory for reuse.
Sourcepub fn without_hashes(self, without_hashes: bool) -> Self
pub fn without_hashes(self, without_hashes: bool) -> Self
Prevents hashes from being stored in the encoded BOC.
(overwrites descriptor flag store_hashes during serialization).
Sourcepub fn encode_to_writer<W: Write>(&self, writer: W) -> Result<()>
pub fn encode_to_writer<W: Write>(&self, writer: W) -> Result<()>
Writes cell trees into the writer.
NOTE: Use BocHeader::encode when possible since it’s faster.
Sourcepub fn compute_stats(&self) -> BocHeaderStats
pub fn compute_stats(&self) -> BocHeaderStats
Computes the encoded BOC size and other stuff.