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
impl VariantTy
pub const BOOLEAN: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BOOLEAN) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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) }
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)
}
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) }
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)
}
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) }
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>
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
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 is_definite(&self) -> bool
pub fn is_definite(&self) -> bool
Check if this variant type is a definite type.
pub fn is_container(&self) -> bool
pub fn is_container(&self) -> bool
Check if this variant type is a container type.
pub fn is_dict_entry(&self) -> bool
pub fn is_dict_entry(&self) -> bool
Check if this variant type is a dict entry type.
pub fn is_variant(&self) -> bool
pub fn is_variant(&self) -> bool
Check if this variant type is a variant.
pub fn is_subtype_of(&self, supertype: &VariantTy) -> bool
pub fn is_subtype_of(&self, supertype: &VariantTy) -> bool
Check if this variant type is a subtype of another.
pub fn element(&self) -> &VariantTy
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<'_> ⓘ
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>
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.
Trait Implementations§
§impl AsRef<VariantTy> for VariantType
impl AsRef<VariantTy> for VariantType
§impl Borrow<VariantTy> for VariantType
impl Borrow<VariantTy> for VariantType
§impl<'a, 'b> PartialEq<&'a VariantTy> for Cow<'b, VariantTy>
impl<'a, 'b> PartialEq<&'a VariantTy> for Cow<'b, VariantTy>
§impl<'a, 'b> PartialEq<&'a VariantTy> for String
impl<'a, 'b> PartialEq<&'a VariantTy> for String
§impl<'a, 'b> PartialEq<&'a VariantTy> for VariantType
impl<'a, 'b> PartialEq<&'a VariantTy> for VariantType
§impl<'a, 'b> PartialEq<&'a VariantTy> for str
impl<'a, 'b> PartialEq<&'a VariantTy> for str
§impl<'a, 'b> PartialEq<Cow<'b, VariantTy>> for &'a VariantTy
impl<'a, 'b> PartialEq<Cow<'b, VariantTy>> for &'a VariantTy
§impl<'a, 'b> PartialEq<VariantTy> for VariantType
impl<'a, 'b> PartialEq<VariantTy> for VariantType
§impl<'a, 'b> PartialEq<VariantType> for &'a VariantTy
impl<'a, 'b> PartialEq<VariantType> for &'a VariantTy
§fn eq(&self, other: &VariantType) -> bool
fn eq(&self, other: &VariantType) -> bool
self
and other
values to be equal, and is used
by ==
.§impl<'a, 'b> PartialEq<VariantType> for VariantTy
impl<'a, 'b> PartialEq<VariantType> for VariantTy
§fn eq(&self, other: &VariantType) -> bool
fn eq(&self, other: &VariantType) -> bool
self
and other
values to be equal, and is used
by ==
.§impl StaticType for VariantTy
impl StaticType for VariantTy
§fn static_type() -> Type
fn static_type() -> Type
Self
.