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§
sourcefn from_json_bytes(data: &[u8]) -> Result<Self, Error>
fn from_json_bytes(data: &[u8]) -> Result<Self, Error>
Deserialize an object from JSON encoded bytes.
sourcefn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error>
fn from_msgpack_bytes(data: &[u8]) -> Result<Self, Error>
Deserialize an object from MsgPack
encoded bytes.
sourcefn as_json_bytes(&self) -> Result<Bytes, Error>
fn as_json_bytes(&self) -> Result<Bytes, Error>
Serialize an object to JSON encoded bytes.
sourcefn as_msgpack_bytes(&self) -> Result<Bytes, Error>
fn as_msgpack_bytes(&self) -> Result<Bytes, Error>
Serialize an object to MsgPack
encoded bytes.
Object Safety§
This trait is not object safe.