Struct Boc

Source
pub struct Boc;
Expand description

BOC (Bag Of Cells) helper.

Implementations§

Source§

impl Boc

Source

pub fn file_hash(data: impl AsRef<[u8]>) -> HashBytes

Computes a simple SHA256 hash of the data.

Source

pub fn encode_hex<T>(cell: T) -> String
where T: AsRef<DynCell>,

Encodes the specified cell tree as BOC and returns the hex encoded bytes as a string.

Source

pub fn encode_base64<T>(cell: T) -> String
where T: AsRef<DynCell>,

Encodes the specified cell tree as BOC and returns the base64 encoded bytes as a string.

Source

pub fn encode<T>(cell: T) -> Vec<u8>
where T: AsRef<DynCell>,

Encodes the specified cell tree as BOC.

Source

pub fn encode_with_cache<T>( cell: T, cache: &mut BocHeaderCache<RandomState>, ) -> Vec<u8>
where T: AsRef<DynCell>,

Encodes the specified cell tree as BOC using preallocated revs cache.

Source

pub fn encode_pair<T1, T2>((cell1, cell2): (T1, T2)) -> Vec<u8>
where T1: AsRef<DynCell>, T2: AsRef<DynCell>,

Encodes a pair of cell trees as BOC.

Source

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.

Source

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.

Source

pub fn decode<T>(data: T) -> Result<Cell, Error>
where T: AsRef<[u8]>,

Decodes a cell tree using an empty cell context.

Source

pub fn decode_pair<T>(data: T) -> Result<(Cell, Cell), Error>
where T: AsRef<[u8]>,

Decodes a pair of cell trees using an empty cell context.

Source

pub fn decode_ext(data: &[u8], context: &dyn CellContext) -> Result<Cell, Error>

Decodes a cell tree using the specified cell context.

Source

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.

Source

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

Source

pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
where SerdeBoc<T>: Deserialize<'de>, D: Deserializer<'de>,

Deserializes cell from an encoded BOC (from base64 for human readable deserializers).

Auto Trait Implementations§

§

impl Freeze for Boc

§

impl RefUnwindSafe for Boc

§

impl Send for Boc

§

impl Sync for Boc

§

impl Unpin for Boc

§

impl UnwindSafe for Boc

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