Struct BocHeader

Source
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,

Source

pub fn with_root(root: &'a DynCell) -> Self

Creates an intermediate BOC serializer state with a single root.

Source

pub fn with_capacity(capacity: usize) -> Self

Creates an empty intermediate BOC serializer state. Reserves space for the specified number of cells.

Source

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,

Source

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.

Source

pub fn into_cache(self) -> BocHeaderCache<S>

Transforms BocHeader into reusable revs cache.

Source

pub fn clear(&mut self)

Clears the header, removing all cells. Keeps the allocated memory for reuse.

Source

pub fn add_root(&mut self, root: &'a DynCell)

Adds an additional root to the state.

Source

pub fn with_crc(self, include_ctc: bool) -> Self

Includes CRC bytes in the encoded BOC.

Source

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).

Source

pub fn encode(&self, target: &mut Vec<u8>)

Encodes cell trees into bytes.

Source

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.

Source

pub fn compute_stats(&self) -> BocHeaderStats

Computes the encoded BOC size and other stuff.

Trait Implementations§

Source§

impl<S: BuildHasher + Default> Default for BocHeader<'_, S>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a, S> Freeze for BocHeader<'a, S>
where S: Freeze,

§

impl<'a, S = RandomState> !RefUnwindSafe for BocHeader<'a, S>

§

impl<'a, S> Send for BocHeader<'a, S>
where S: Send,

§

impl<'a, S> Sync for BocHeader<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for BocHeader<'a, S>
where S: Unpin,

§

impl<'a, S = RandomState> !UnwindSafe for BocHeader<'a, S>

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> 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, 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