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§

source

fn to_binary(&self) -> Result<Vec<u8>, MessageFormatError>

Convert to binary.

source

fn to_json(&self) -> Result<String, MessageFormatError>

Convert to json.

source

fn to_base64(&self) -> Result<String, MessageFormatError>

Convert to base64.

source

fn from_binary(msg: &[u8]) -> Result<Self, MessageFormatError>

Convert from binary.

source

fn from_json(msg: &str) -> Result<Self, MessageFormatError>

Convert from json.

source

fn from_base64(msg: &str) -> Result<Self, MessageFormatError>

Convert from base64.

Implementors§