Skip to main content

Variant

Enum Variant 

Source
pub enum Variant {
Show 22 variants Null, Boolean(bool), Ubyte(u8), Ushort(u16), Uint(u32), Ulong(u64), Byte(i8), Short(i16), Int(i32), Long(i64), Float(OrderedFloat<f32>), Double(OrderedFloat<f64>), Char(char), Timestamp(DateTime<Utc>), Uuid(Uuid), Binary(Bytes), String(Str), Symbol(Symbol), StaticSymbol(StaticSymbol), List(List), Map(VariantMap), Described((Descriptor, Box<Variant>)),
}
Expand description

Represents an AMQP type for use in polymorphic collections

Variants§

§

Null

Indicates an empty value.

§

Boolean(bool)

Represents a true or false value.

§

Ubyte(u8)

Integer in the range 0 to 2^8 - 1 inclusive.

§

Ushort(u16)

Integer in the range 0 to 2^16 - 1 inclusive.

§

Uint(u32)

Integer in the range 0 to 2^32 - 1 inclusive.

§

Ulong(u64)

Integer in the range 0 to 2^64 - 1 inclusive.

§

Byte(i8)

Integer in the range 0 to 2^7 - 1 inclusive.

§

Short(i16)

Integer in the range 0 to 2^15 - 1 inclusive.

§

Int(i32)

Integer in the range 0 to 2^32 - 1 inclusive.

§

Long(i64)

Integer in the range 0 to 2^64 - 1 inclusive.

§

Float(OrderedFloat<f32>)

32-bit floating point number (IEEE 754-2008 binary32).

§

Double(OrderedFloat<f64>)

64-bit floating point number (IEEE 754-2008 binary64).

§

Char(char)

A single Unicode character.

§

Timestamp(DateTime<Utc>)

An absolute point in time. Represents an approximate point in time using the Unix time encoding of UTC with a precision of milliseconds. For example, 1311704463521 represents the moment 2011-07-26T18:21:03.521Z.

§

Uuid(Uuid)

A universally unique identifier as defined by RFC-4122 section 4.1.2

§

Binary(Bytes)

A sequence of octets.

§

String(Str)

A sequence of Unicode characters

§

Symbol(Symbol)

Symbolic values from a constrained domain.

§

StaticSymbol(StaticSymbol)

Same as Symbol but for static refs

§

List(List)

List

§

Map(VariantMap)

Map

§

Described((Descriptor, Box<Variant>))

Described value

Implementations§

Source§

impl Variant

Source

pub fn as_str(&self) -> Option<&str>

Source

pub fn as_int(&self) -> Option<i32>

Source

pub fn as_long(&self) -> Option<i64>

Source

pub fn to_bytes_str(&self) -> Option<ByteString>

Trait Implementations§

Source§

impl Clone for Variant

Source§

fn clone(&self) -> Variant

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Variant

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Variant

Source§

fn fmt(&self, _derive_more_display_formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Encode for Variant

Source§

fn encode(&self, buf: &mut BytesMut)

Encodes Variant into provided BytesMut

Source§

fn encoded_size(&self) -> usize

Source§

impl Eq for Variant

Source§

impl From<&'static str> for Variant

Source§

fn from(s: &'static str) -> Self

Converts to this type from the input type.
Source§

impl From<()> for Variant

Source§

fn from(original: ()) -> Variant

Converts to this type from the input type.
Source§

impl From<(Descriptor, Box<Variant>)> for Variant

Source§

fn from(original: (Descriptor, Box<Variant>)) -> Variant

Converts to this type from the input type.
Source§

impl From<ByteString> for Variant

Source§

fn from(s: ByteString) -> Self

Converts to this type from the input type.
Source§

impl From<Bytes> for Variant

Source§

fn from(original: Bytes) -> Variant

Converts to this type from the input type.
Source§

impl From<DateTime<Utc>> for Variant

Source§

fn from(original: DateTime<Utc>) -> Variant

Converts to this type from the input type.
Source§

impl From<List> for Variant

Source§

fn from(original: List) -> Variant

Converts to this type from the input type.
Source§

impl From<OrderedFloat<f32>> for Variant

Source§

fn from(original: OrderedFloat<f32>) -> Variant

Converts to this type from the input type.
Source§

impl From<OrderedFloat<f64>> for Variant

Source§

fn from(original: OrderedFloat<f64>) -> Variant

Converts to this type from the input type.
Source§

impl From<StaticSymbol> for Variant

Source§

fn from(original: StaticSymbol) -> Variant

Converts to this type from the input type.
Source§

impl From<Str> for Variant

Source§

fn from(original: Str) -> Variant

Converts to this type from the input type.
Source§

impl From<String> for Variant

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<Symbol> for Variant

Source§

fn from(original: Symbol) -> Variant

Converts to this type from the input type.
Source§

impl From<Uuid> for Variant

Source§

fn from(original: Uuid) -> Variant

Converts to this type from the input type.
Source§

impl From<VariantMap> for Variant

Source§

fn from(original: VariantMap) -> Variant

Converts to this type from the input type.
Source§

impl From<bool> for Variant

Source§

fn from(original: bool) -> Variant

Converts to this type from the input type.
Source§

impl From<char> for Variant

Source§

fn from(original: char) -> Variant

Converts to this type from the input type.
Source§

impl From<i8> for Variant

Source§

fn from(original: i8) -> Variant

Converts to this type from the input type.
Source§

impl From<i16> for Variant

Source§

fn from(original: i16) -> Variant

Converts to this type from the input type.
Source§

impl From<i32> for Variant

Source§

fn from(original: i32) -> Variant

Converts to this type from the input type.
Source§

impl From<i64> for Variant

Source§

fn from(original: i64) -> Variant

Converts to this type from the input type.
Source§

impl From<u8> for Variant

Source§

fn from(original: u8) -> Variant

Converts to this type from the input type.
Source§

impl From<u16> for Variant

Source§

fn from(original: u16) -> Variant

Converts to this type from the input type.
Source§

impl From<u32> for Variant

Source§

fn from(original: u32) -> Variant

Converts to this type from the input type.
Source§

impl From<u64> for Variant

Source§

fn from(original: u64) -> Variant

Converts to this type from the input type.
Source§

impl Hash for Variant

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Variant

Source§

fn eq(&self, other: &Variant) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<str> for Variant

Source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Variant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Decode for T
where T: DecodeFormatted,

Source§

fn decode(input: &[u8]) -> Result<(&[u8], T), AmqpParseError>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.