nautilus_core::serialization

Trait Serializable

source
pub trait Serializable: Serialize + for<'de> Deserialize<'de> {
    // Provided methods
    fn from_json_bytes(data: &[u8]) -> Result<Self, Error> { ... }
    fn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error> { ... }
    fn as_json_bytes(&self) -> Result<Bytes, Error> { ... }
    fn as_msgpack_bytes(&self) -> Result<Bytes, Error> { ... }
}
Expand description

Represents types which are serializable for JSON and MsgPack specifications.

Provided Methods§

source

fn from_json_bytes(data: &[u8]) -> Result<Self, Error>

Deserialize an object from JSON encoded bytes.

source

fn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error>

Deserialize an object from MsgPack encoded bytes.

source

fn as_json_bytes(&self) -> Result<Bytes, Error>

Serialize an object to JSON encoded bytes.

source

fn as_msgpack_bytes(&self) -> Result<Bytes, Error>

Serialize an object to MsgPack encoded bytes.

Object Safety§

This trait is not object safe.

Implementors§