RemotingDeserializable

Trait RemotingDeserializable 

Source
pub trait RemotingDeserializable {
    type Output;

    // Required method
    fn decode(bytes: &[u8]) -> RocketMQResult<Self::Output>;
}
Expand description

Trait for deserializing objects in a remoting context.

This trait defines a method for deserializing objects from a binary format, typically received over a network. Implementors of this trait can specify their own output types and deserialization logic, making it flexible for various use cases.

§Type Parameters

  • Output: The type of the object after deserialization.

Required Associated Types§

Source

type Output

The output type resulting from the deserialization.

Required Methods§

Source

fn decode(bytes: &[u8]) -> RocketMQResult<Self::Output>

Deserializes an object from a slice of bytes.

This method attempts to convert a slice of bytes into an instance of the Output type. It returns a Result indicating either success with the deserialized object or an error if deserialization fails.

§Arguments
  • bytes - A slice of bytes representing the serialized object.
§Returns

A Result containing either the deserialized object of type Output or an Error if deserialization fails.

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§