Struct 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
impl VariantTy
pub const OBJECT_PATH: &'static VariantTy
pub const OBJECT_PATH: &'static VariantTy
DBus object path.
pub const ANY: &'static VariantTy
pub const ANY: &'static VariantTy
An indefinite type that is a supertype of every type (including itself).
pub const DICT_ENTRY: &'static VariantTy
pub const DICT_ENTRY: &'static VariantTy
Any dict entry type, i.e. DictEntry<K, V>.
pub const DICTIONARY: &'static VariantTy
pub const DICTIONARY: &'static VariantTy
Any dictionary type, i.e. HashMap<K, V>, BTreeMap<K, V>.
pub const STRING_ARRAY: &'static VariantTy
pub const STRING_ARRAY: &'static VariantTy
String array, i.e. [&str].
pub const OBJECT_PATH_ARRAY: &'static VariantTy
pub const OBJECT_PATH_ARRAY: &'static VariantTy
Object path array, i.e. [&str].
pub const BYTE_STRING: &'static VariantTy
pub const BYTE_STRING: &'static VariantTy
Byte string, i.e. [u8].
pub const BYTE_STRING_ARRAY: &'static VariantTy
pub const BYTE_STRING_ARRAY: &'static VariantTy
Byte string array, i.e. [[u8]].
pub const VARDICT: &'static VariantTy
pub const VARDICT: &'static VariantTy
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 VariantType
impl<'a, 'b> PartialEq<&'a VariantTy> for VariantType
§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
§impl<'a, 'b> PartialEq<VariantType> for VariantTy
impl<'a, 'b> PartialEq<VariantType> for VariantTy
§impl StaticType for VariantTy
impl StaticType for VariantTy
§fn static_type() -> Type
fn static_type() -> Type
Self.§impl ToOwned for VariantTy
impl ToOwned for VariantTy
§type Owned = VariantType
type Owned = VariantType
§fn to_owned(&self) -> VariantType
fn to_owned(&self) -> VariantType
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
impl Eq for VariantTy
impl StructuralPartialEq for VariantTy
impl Sync for VariantTy
Auto Trait Implementations§
impl Freeze for VariantTy
impl RefUnwindSafe for VariantTy
impl Send for VariantTy
impl !Sized for VariantTy
impl Unpin for VariantTy
impl UnwindSafe for VariantTy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToSendValue for T
impl<T> ToSendValue for T
§fn to_send_value(&self) -> SendValue
fn to_send_value(&self) -> SendValue
SendValue clone of self.