pub enum UIntByteRepr {
ZeroOctet([u8; 1]),
SingleOctet([u8; 2]),
FourOctets([u8; 5]),
}Expand description
Represents the different byte encodings of a 32-bit unsigned signed.
This enum provides three variants based on the size of the signed’s encoding:
ZeroOctet: Represents an signed value of0, encoded as a single byte[0x43].SingleOctet: Represents integers that can fit into a single byte, encoded as two bytes[0x52, x].FourOctets: Represents integers requiring a full 32-bit representation, encoded as five bytes[0x70, x1, x2, x3, x4].
These formats are designed to handle encoded AMQP integers.
Variants§
ZeroOctet([u8; 1])
Represents the zero-byte encoding of a 32-bit unsigned signed.
This variant is used when the signed value is 0. It is represented
as a single byte [0x43].
§Example
use flederfuchs_amqp::UIntByteRepr;
let encoding = UIntByteRepr::ZeroOctet([0x43]);
assert_eq!(encoding, UIntByteRepr::ZeroOctet([0x43]));SingleOctet([u8; 2])
Represents the single-octet encoding of a 32-bit unsigned signed.
This variant is used when the signed value fits within a single byte.
It is represented as two bytes [0x52, x], where x is the signed value.
§Example
use flederfuchs_amqp::UIntByteRepr;
let encoding = UIntByteRepr::SingleOctet([0x52, 0x7F]);
assert_eq!(encoding, UIntByteRepr::SingleOctet([0x52, 0x7F]));FourOctets([u8; 5])
Represents the four-octet encoding of a 32-bit unsigned signed.
This variant is used when the signed value requires the full 32-bit representation.
It is represented as five bytes [0x70, x1, x2, x3, x4], where x1..x4 are the big-endian
bytes of the signed value.
§Example
use flederfuchs_amqp::UIntByteRepr;
let encoding = UIntByteRepr::FourOctets([0x70, 0x01, 0x02, 0x03, 0x04]);
assert_eq!(encoding, UIntByteRepr::FourOctets([0x70, 0x01, 0x02, 0x03, 0x04]));Trait Implementations§
Source§impl Clone for UIntByteRepr
impl Clone for UIntByteRepr
Source§fn clone(&self) -> UIntByteRepr
fn clone(&self) -> UIntByteRepr
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more