RemotingSerializable

Trait RemotingSerializable 

Source
pub trait RemotingSerializable {
    // Required methods
    fn encode(&self) -> RocketMQResult<Vec<u8>>;
    fn serialize_json(&self) -> RocketMQResult<String>;
    fn serialize_json_pretty(&self) -> RocketMQResult<String>;
}
Expand description

Trait for serializable objects in a remoting context.

This trait defines methods for serializing objects into different formats, including binary, standard JSON, and pretty-printed JSON. It is intended for use with types that need to be transmitted over a network or stored in a format that can be easily shared or read.

Required Methods§

Source

fn encode(&self) -> RocketMQResult<Vec<u8>>

Encodes the object into a vector of bytes.

§Returns

A Result containing a vector of bytes representing the encoded object, or an error if encoding fails.

Source

fn serialize_json(&self) -> RocketMQResult<String>

Serializes the object into a JSON string.

§Returns

A Result containing a JSON string representing the object, or an error if serialization fails.

Source

fn serialize_json_pretty(&self) -> RocketMQResult<String>

Serializes the object into a pretty-printed JSON string.

§Returns

A Result containing a pretty-printed JSON string representing the object, or an error if serialization fails.

Implementors§