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.
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.