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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§