pub struct Boc;Expand description
BOC (Bag Of Cells) helper.
Implementations§
Source§impl Boc
impl Boc
Sourcepub fn file_hash(data: impl AsRef<[u8]>) -> HashBytes
pub fn file_hash(data: impl AsRef<[u8]>) -> HashBytes
Computes a simple SHA256 hash of the data.
Sourcepub fn encode_hex<T>(cell: T) -> String
pub fn encode_hex<T>(cell: T) -> String
Encodes the specified cell tree as BOC and
returns the hex encoded bytes as a string.
Sourcepub fn encode_base64<T>(cell: T) -> String
pub fn encode_base64<T>(cell: T) -> String
Encodes the specified cell tree as BOC and
returns the base64 encoded bytes as a string.
Sourcepub fn encode_with_cache<T>(
cell: T,
cache: &mut BocHeaderCache<RandomState>,
) -> Vec<u8> ⓘ
pub fn encode_with_cache<T>( cell: T, cache: &mut BocHeaderCache<RandomState>, ) -> Vec<u8> ⓘ
Encodes the specified cell tree as BOC using preallocated revs cache.
Sourcepub fn encode_pair<T1, T2>((cell1, cell2): (T1, T2)) -> Vec<u8> ⓘ
pub fn encode_pair<T1, T2>((cell1, cell2): (T1, T2)) -> Vec<u8> ⓘ
Encodes a pair of cell trees as BOC.
Sourcepub fn decode_hex<T: AsRef<[u8]>>(data: T) -> Result<Cell, Error>
pub fn decode_hex<T: AsRef<[u8]>>(data: T) -> Result<Cell, Error>
Decodes a hex encoded BOC into a cell tree
using an empty cell context.
Sourcepub fn decode_base64<T: AsRef<[u8]>>(data: T) -> Result<Cell, Error>
pub fn decode_base64<T: AsRef<[u8]>>(data: T) -> Result<Cell, Error>
Decodes a base64 encoded BOC into a cell tree
using an empty cell context.
Sourcepub fn decode<T>(data: T) -> Result<Cell, Error>
pub fn decode<T>(data: T) -> Result<Cell, Error>
Decodes a cell tree using an empty cell context.
Sourcepub fn decode_pair<T>(data: T) -> Result<(Cell, Cell), Error>
pub fn decode_pair<T>(data: T) -> Result<(Cell, Cell), Error>
Decodes a pair of cell trees using an empty cell context.
Sourcepub fn decode_ext(data: &[u8], context: &dyn CellContext) -> Result<Cell, Error>
pub fn decode_ext(data: &[u8], context: &dyn CellContext) -> Result<Cell, Error>
Decodes a cell tree using the specified cell context.
Sourcepub fn decode_pair_ext(
data: &[u8],
context: &dyn CellContext,
) -> Result<(Cell, Cell), Error>
pub fn decode_pair_ext( data: &[u8], context: &dyn CellContext, ) -> Result<(Cell, Cell), Error>
Decodes a pair of cell trees using the specified cell context.
Sourcepub fn serialize<T, S>(value: T, serializer: S) -> Result<S::Ok, S::Error>
pub fn serialize<T, S>(value: T, serializer: S) -> Result<S::Ok, S::Error>
Serializes cell into an encoded BOC (as base64 for human readable serializers).
Sourcepub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
Deserializes cell from an encoded BOC (from base64 for human readable deserializers).