pub struct DescribedCompound { /* private fields */ }Expand description
Represents a compound value with a descriptor. The value contains data starting with format code for the underlying AMQP type (right after the descriptor).
Implementations§
Source§impl DescribedCompound
impl DescribedCompound
Sourcepub fn create<T: Encode>(descriptor: Descriptor, value: T) -> Self
pub fn create<T: Encode>(descriptor: Descriptor, value: T) -> Self
Creates a representation of described value of compound value type based on T type’s AMQP encoding.
T’s implementation of Encode is expected to produce the binary representation of the T in an underlying AMQP type value, starting from the format code.
For instance, if the described value is to be represented as an AMQP list with 1 ubyte field with a value of 3:
0x00 0xa3 0x07 "foo:bar" 0xc0 0x02 0x01 0x50 0x03The T::encode method is expected to produce the following output:
0xc0 0x02 0x01 0x50 0x03pub fn descriptor(&self) -> &Descriptor
Sourcepub fn decode<T: Decode>(&self) -> Result<T, AmqpParseError>
pub fn decode<T: Decode>(&self) -> Result<T, AmqpParseError>
Attempts to decode the described value as T.
T’s implementation of Decode is expected to parse the underlying AMQP type starting from the format code.
For instance, if the value is of described type represented by AMQP list with 1 ubyte field with a value of 3:
0x00 0xa3 0x07 "foo:bar" 0xc0 0x02 0x01 0x50 0x03The T::decode method will be called with the following input:
0xc0 0x02 0x01 0x50 0x03Trait Implementations§
Source§impl Clone for DescribedCompound
impl Clone for DescribedCompound
Source§fn clone(&self) -> DescribedCompound
fn clone(&self) -> DescribedCompound
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more