Struct druid::piet::cairo::glib::VariantTy

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

Describes Variant types.

This is a borrowed counterpart of VariantType. Essentially it’s a str statically guaranteed to be a valid type string.

Implementations§

§

impl VariantTy

pub const BOOLEAN: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BOOLEAN) }

bool.

pub const BYTE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BYTE) }

u8.

pub const INT16: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_INT16) }

i16.

pub const UINT16: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UINT16) }

u16.

pub const INT32: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_INT32) }

i32.

pub const UINT32: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UINT32) }

u32.

pub const INT64: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_INT64) }

i64.

pub const UINT64: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UINT64) }

u64.

pub const DOUBLE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_DOUBLE) }

f64.

pub const STRING: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_STRING) }

&str.

pub const OBJECT_PATH: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_OBJECT_PATH) }

DBus object path.

pub const SIGNATURE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_SIGNATURE) }

Type signature.

pub const VARIANT: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_VARIANT) }

Variant.

pub const HANDLE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_HANDLE) }

Handle.

pub const UNIT: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UNIT) }

Unit, i.e. ().

pub const ANY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_ANY) }

An indefinite type that is a supertype of every type (including itself).

pub const BASIC: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BASIC) }

Any basic type.

pub const MAYBE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_MAYBE) }

Any maybe type, i.e. Option<T>.

pub const ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_ARRAY) }

Any array type, i.e. [T].

pub const TUPLE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_TUPLE) }

Any tuple type, i.e. (T), (T, T), etc.

pub const DICT_ENTRY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_DICT_ENTRY) }

Any dict entry type, i.e. DictEntry<K, V>.

pub const DICTIONARY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_DICTIONARY) }

Any dictionary type, i.e. HashMap<K, V>, BTreeMap<K, V>.

pub const STRING_ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_STRING_ARRAY) }

String array, i.e. [&str].

pub const OBJECT_PATH_ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_OBJECT_PATH_ARRAY) }

Object path array, i.e. [&str].

pub const BYTE_STRING: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BYTE_STRING) }

Byte string, i.e. [u8].

pub const BYTE_STRING_ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BYTE_STRING_ARRAY) }

Byte string array, i.e. [[u8]].

pub const VARDICT: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_VARDICT) }

Variant dictionary, i.e. HashMap<String, Variant>, BTreeMap<String, Variant>, etc.

pub fn new(type_string: &str) -> Result<&VariantTy, BoolError>

Tries to create a &VariantTy from a string slice.

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

pub const unsafe fn from_str_unchecked(type_string: &str) -> &VariantTy

Converts a type string into &VariantTy without any checks.

Safety

The caller is responsible for passing in only a valid variant type string.

pub fn as_str(&self) -> &str

Converts to a string slice.

pub fn is_definite(&self) -> bool

Check if this variant type is a definite type.

pub fn is_container(&self) -> bool

Check if this variant type is a container type.

pub fn is_basic(&self) -> bool

Check if this variant type is a basic type.

pub fn is_maybe(&self) -> bool

Check if this variant type is a maybe type.

pub fn is_array(&self) -> bool

Check if this variant type is an array type.

pub fn is_tuple(&self) -> bool

Check if this variant type is a tuple type.

pub fn is_dict_entry(&self) -> bool

Check if this variant type is a dict entry type.

pub fn is_variant(&self) -> bool

Check if this variant type is a variant.

pub fn is_subtype_of(&self, supertype: &VariantTy) -> bool

Check if this variant type is a subtype of another.

pub fn element(&self) -> &VariantTy

Return the element type of this variant type.

Panics

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

pub fn tuple_types(&self) -> VariantTyIterator<'_>

Iterate over the types of this variant type.

Panics

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

pub fn first(&self) -> Option<&VariantTy>

Return the first type of this variant type.

Panics

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

pub fn next(&self) -> Option<&VariantTy>

Return the next type of this variant type.

pub fn n_items(&self) -> usize

Return the number of items in this variant type.

pub fn key(&self) -> &VariantTy

Return the key type of this variant type.

Panics

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

pub fn value(&self) -> &VariantTy

Return the value type of this variant type.

Panics

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

Trait Implementations§

§

impl AsRef<VariantTy> for VariantTy

§

fn as_ref(&self) -> &VariantTy

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

impl AsRef<VariantTy> for VariantType

§

fn as_ref(&self) -> &VariantTy

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

impl Borrow<VariantTy> for VariantType

§

fn borrow(&self) -> &VariantTy

Immutably borrows from an owned value. Read more
§

impl Debug for VariantTy

§

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

Formats the value using the given formatter. Read more
§

impl Display for VariantTy

§

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

Formats the value using the given formatter. Read more
§

impl<'a> From<&'a VariantTy> for Cow<'a, VariantTy>

§

fn from(ty: &'a VariantTy) -> Cow<'a, VariantTy>

Converts to this type from the input type.
§

impl Hash for VariantTy

§

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

Feeds this value into the given Hasher. Read more
§

impl<'a, 'b> PartialEq<&'a VariantTy> for Cow<'b, VariantTy>

§

fn eq(&self, other: &&'a VariantTy) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<&'a VariantTy> for String

§

fn eq(&self, other: &&'a VariantTy) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<&'a VariantTy> for VariantType

§

fn eq(&self, other: &&'a VariantTy) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<&'a VariantTy> for str

§

fn eq(&self, other: &&'a VariantTy) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<&'a str> for VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<Cow<'b, VariantTy>> for &'a VariantTy

§

fn eq(&self, other: &Cow<'b, VariantTy>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<String> for &'a VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<String> for VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<VariantTy> for &'a str

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<VariantTy> for String

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl PartialEq<VariantTy> for VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<VariantTy> for VariantType

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<VariantTy> for str

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<VariantType> for &'a VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<VariantType> for VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<str> for &'a VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<'a, 'b> PartialEq<str> for VariantTy

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl StaticType for VariantTy

§

fn static_type() -> Type

Returns the type identifier of Self.
§

impl ToOwned for VariantTy

§

type Owned = VariantType

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> VariantType

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

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

impl Eq for VariantTy

§

impl StructuralEq for VariantTy

§

impl StructuralPartialEq for VariantTy

§

impl Sync for VariantTy

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> ToSendValue for Twhere T: Send + ToValue + ?Sized,

§

fn to_send_value(&self) -> SendValue

Returns a SendValue clone of self.
source§

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

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more