pub struct BocRepr;
Expand description
BOC representation helper.
Implementations§
Source§impl BocRepr
impl BocRepr
Sourcepub fn encode_hex<T>(data: T) -> Result<String, Error>where
T: Store,
pub fn encode_hex<T>(data: T) -> Result<String, Error>where
T: Store,
Encodes the specified cell tree as BOC using an empty cell context and
returns the hex
encoded bytes as a string.
Sourcepub fn encode_base64<T>(data: T) -> Result<String, Error>where
T: Store,
pub fn encode_base64<T>(data: T) -> Result<String, Error>where
T: Store,
Encodes the specified cell tree as BOC using an empty cell context and
returns the base64
encoded bytes as a string.
Sourcepub fn encode<T>(data: T) -> Result<Vec<u8>, Error>where
T: Store,
pub fn encode<T>(data: T) -> Result<Vec<u8>, Error>where
T: Store,
Encodes the specified cell tree as BOC using an empty cell context.
Sourcepub fn decode_hex<T, D>(data: D) -> Result<T, BocReprError>
pub fn decode_hex<T, D>(data: D) -> Result<T, BocReprError>
Decodes a hex
encoded BOC into an object
using an empty cell context.
Sourcepub fn decode_base64<T, D>(data: D) -> Result<T, BocReprError>
pub fn decode_base64<T, D>(data: D) -> Result<T, BocReprError>
Decodes a base64
encoded BOC into an object
using an empty cell context.
Sourcepub fn decode<T, D>(data: D) -> Result<T, BocReprError>
pub fn decode<T, D>(data: D) -> Result<T, BocReprError>
Decodes an object using an empty cell context.
Sourcepub fn encode_ext<T>(
data: T,
context: &mut dyn CellContext,
) -> Result<Vec<u8>, Error>where
T: Store,
pub fn encode_ext<T>(
data: T,
context: &mut dyn CellContext,
) -> Result<Vec<u8>, Error>where
T: Store,
Encodes the specified object as BOC.
Sourcepub fn decode_ext<T>(
data: &[u8],
context: &mut dyn CellContext,
) -> Result<T, BocReprError>where
for<'a> T: Load<'a>,
pub fn decode_ext<T>(
data: &[u8],
context: &mut dyn CellContext,
) -> Result<T, BocReprError>where
for<'a> T: Load<'a>,
Decodes object from BOC using the specified cell context.
Sourcepub fn serialize<S, T>(data: &T, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
T: Store,
pub fn serialize<S, T>(data: &T, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
T: Store,
Serializes the type into an encoded BOC using an empty cell context (as base64 for human readable serializers).
Sourcepub fn deserialize<'de, D, T>(deserializer: D) -> Result<T, D::Error>where
D: Deserializer<'de>,
for<'a> T: Load<'a>,
pub fn deserialize<'de, D, T>(deserializer: D) -> Result<T, D::Error>where
D: Deserializer<'de>,
for<'a> T: Load<'a>,
Deserializes the type from an encoded BOC using an empty cell context (from base64 for human readable serializers).