pub struct VariantType { /* private fields */ }
Expand description

Describes Variant types.

The Variant type system (based on the D-Bus one) describes types with “type strings”. VariantType is an owned immutable type string (you can think of it as a Box<str> statically guaranteed to be a valid type string), &VariantTy is a borrowed one (like &str).

Implementations

Tries to create a VariantType from a string slice.

Returns Ok if the string is a valid type string, Err otherwise.

source

pub fn new_dict_entry(
    key_type: &VariantTy,
    value_type: &VariantTy
) -> VariantType

Creates a VariantType from a key and value type.

Creates a VariantType from an array element type.

Creates a VariantType from a maybe element type.

Creates a VariantType from a maybe element type.

Tries to create a VariantType from an owned string.

Returns Ok if the string is a valid type string, Err otherwise.

Methods from Deref<Target = VariantTy>

source

pub const DICT_ENTRY: &'static VariantTy = _

Converts to a string slice.

Check if this variant type is a definite type.

Check if this variant type is a container type.

Check if this variant type is a basic type.

Check if this variant type is a maybe type.

Check if this variant type is an array type.

Check if this variant type is a tuple type.

source

pub fn is_dict_entry(&self) -> bool

Check if this variant type is a dict entry type.

Check if this variant type is a variant.

Check if this variant type is a subtype of another.

Return the element type of this variant type.

Panics

This function panics if not called with an array or maybe type.

Iterate over the types of this variant type.

Panics

This function panics if not called with a tuple or dictionary entry type.

Return the first type of this variant type.

Panics

This function panics if not called with a tuple or dictionary entry type.

Return the next type of this variant type.

Return the number of items in this variant type.

Return the key type of this variant type.

Panics

This function panics if not called with a dictionary entry type.

Return the value type of this variant type.

Panics

This function panics if not called with a dictionary entry type.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Immutably borrows from an owned value. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Converts to this type from the input type.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Ensures that the type has been registered with the type system.

The resulting type after obtaining ownership.

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

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

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.