Trait tari_utilities::message_format::MessageFormat
source · pub trait MessageFormat: Sized {
// Required methods
fn to_binary(&self) -> Result<Vec<u8>, MessageFormatError>;
fn to_json(&self) -> Result<String, MessageFormatError>;
fn to_base64(&self) -> Result<String, MessageFormatError>;
fn from_binary(msg: &[u8]) -> Result<Self, MessageFormatError>;
fn from_json(msg: &str) -> Result<Self, MessageFormatError>;
fn from_base64(msg: &str) -> Result<Self, MessageFormatError>;
}
Expand description
Trait for converting to/from binary/json/base64.
Required Methods§
sourcefn to_json(&self) -> Result<String, MessageFormatError>
fn to_json(&self) -> Result<String, MessageFormatError>
Convert to json.
sourcefn to_base64(&self) -> Result<String, MessageFormatError>
fn to_base64(&self) -> Result<String, MessageFormatError>
Convert to base64.
sourcefn from_binary(msg: &[u8]) -> Result<Self, MessageFormatError>
fn from_binary(msg: &[u8]) -> Result<Self, MessageFormatError>
Convert from binary.
sourcefn from_json(msg: &str) -> Result<Self, MessageFormatError>
fn from_json(msg: &str) -> Result<Self, MessageFormatError>
Convert from json.
sourcefn from_base64(msg: &str) -> Result<Self, MessageFormatError>
fn from_base64(msg: &str) -> Result<Self, MessageFormatError>
Convert from base64.
Object Safety§
This trait is not object safe.