#[repr(transparent)]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
sourceimpl VariantTy
impl VariantTy
sourcepub const OBJECT_PATH: &'static VariantTy = _
pub const OBJECT_PATH: &'static VariantTy = _
DBus object path.
sourcepub const ANY: &'static VariantTy = _
pub const ANY: &'static VariantTy = _
An indefinite type that is a supertype of every type (including itself).
sourcepub const DICT_ENTRY: &'static VariantTy = _
pub const DICT_ENTRY: &'static VariantTy = _
Any dict entry type, i.e. DictEntry<K, V>
.
sourcepub const DICTIONARY: &'static VariantTy = _
pub const DICTIONARY: &'static VariantTy = _
Any dictionary type, i.e. HashMap<K, V>
, BTreeMap<K, V>
.
sourcepub const STRING_ARRAY: &'static VariantTy = _
pub const STRING_ARRAY: &'static VariantTy = _
String array, i.e. [&str]
.
sourcepub const OBJECT_PATH_ARRAY: &'static VariantTy = _
pub const OBJECT_PATH_ARRAY: &'static VariantTy = _
Object path array, i.e. [&str]
.
sourcepub const BYTE_STRING: &'static VariantTy = _
pub const BYTE_STRING: &'static VariantTy = _
Byte string, i.e. [u8]
.
sourcepub const BYTE_STRING_ARRAY: &'static VariantTy = _
pub const BYTE_STRING_ARRAY: &'static VariantTy = _
Byte string array, i.e. [[u8]]
.
sourcepub const VARDICT: &'static VariantTy = _
pub const VARDICT: &'static VariantTy = _
Variant dictionary, i.e. HashMap<String, Variant>
, BTreeMap<String, Variant>
, etc.
sourcepub 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.
sourcepub 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.
sourcepub fn is_definite(&self) -> bool
pub fn is_definite(&self) -> bool
Check if this variant type is a definite type.
sourcepub fn is_container(&self) -> bool
pub fn is_container(&self) -> bool
Check if this variant type is a container type.
sourcepub fn is_dict_entry(&self) -> bool
pub fn is_dict_entry(&self) -> bool
Check if this variant type is a dict entry type.
sourcepub fn is_variant(&self) -> bool
pub fn is_variant(&self) -> bool
Check if this variant type is a variant.
sourcepub fn is_subtype_of(&self, supertype: &Self) -> bool
pub fn is_subtype_of(&self, supertype: &Self) -> bool
Check if this variant type is a subtype of another.
sourcepub 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.
sourcepub fn tuple_types(&self) -> VariantTyIterator<'_>ⓘNotable traits for VariantTyIterator<'a>impl<'a> Iterator for VariantTyIterator<'a> type Item = &'a VariantTy;
pub fn tuple_types(&self) -> VariantTyIterator<'_>ⓘNotable traits for VariantTyIterator<'a>impl<'a> Iterator for VariantTyIterator<'a> type Item = &'a VariantTy;
Iterate over the types of this variant type.
Panics
This function panics if not called with a tuple or dictionary entry type.
sourcepub 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
sourceimpl AsRef<VariantTy> for VariantType
impl AsRef<VariantTy> for VariantType
sourceimpl Borrow<VariantTy> for VariantType
impl Borrow<VariantTy> for VariantType
sourceimpl<'a, 'b> PartialEq<&'a VariantTy> for Cow<'b, VariantTy>
impl<'a, 'b> PartialEq<&'a VariantTy> for Cow<'b, VariantTy>
sourceimpl<'a, 'b> PartialEq<&'a VariantTy> for String
impl<'a, 'b> PartialEq<&'a VariantTy> for String
sourceimpl<'a, 'b> PartialEq<&'a VariantTy> for VariantType
impl<'a, 'b> PartialEq<&'a VariantTy> for VariantType
sourceimpl<'a, 'b> PartialEq<&'a VariantTy> for str
impl<'a, 'b> PartialEq<&'a VariantTy> for str
sourceimpl<'a, 'b> PartialEq<&'a str> for VariantTy
impl<'a, 'b> PartialEq<&'a str> for VariantTy
sourceimpl<'a, 'b> PartialEq<Cow<'b, VariantTy>> for &'a VariantTy
impl<'a, 'b> PartialEq<Cow<'b, VariantTy>> for &'a VariantTy
sourceimpl<'a, 'b> PartialEq<String> for &'a VariantTy
impl<'a, 'b> PartialEq<String> for &'a VariantTy
sourceimpl<'a, 'b> PartialEq<String> for VariantTy
impl<'a, 'b> PartialEq<String> for VariantTy
sourceimpl<'a, 'b> PartialEq<VariantTy> for &'a str
impl<'a, 'b> PartialEq<VariantTy> for &'a str
sourceimpl<'a, 'b> PartialEq<VariantTy> for String
impl<'a, 'b> PartialEq<VariantTy> for String
sourceimpl PartialEq<VariantTy> for VariantTy
impl PartialEq<VariantTy> for VariantTy
sourceimpl<'a, 'b> PartialEq<VariantTy> for VariantType
impl<'a, 'b> PartialEq<VariantTy> for VariantType
sourceimpl<'a, 'b> PartialEq<VariantTy> for str
impl<'a, 'b> PartialEq<VariantTy> for str
sourceimpl<'a, 'b> PartialEq<VariantType> for &'a VariantTy
impl<'a, 'b> PartialEq<VariantType> for &'a VariantTy
sourcefn eq(&self, other: &VariantType) -> bool
fn eq(&self, other: &VariantType) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl<'a, 'b> PartialEq<VariantType> for VariantTy
impl<'a, 'b> PartialEq<VariantType> for VariantTy
sourcefn eq(&self, other: &VariantType) -> bool
fn eq(&self, other: &VariantType) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl<'a, 'b> PartialEq<str> for &'a VariantTy
impl<'a, 'b> PartialEq<str> for &'a VariantTy
sourceimpl<'a, 'b> PartialEq<str> for VariantTy
impl<'a, 'b> PartialEq<str> for VariantTy
sourceimpl StaticType for VariantTy
impl StaticType for VariantTy
sourcefn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of Self
.
sourceimpl ToOwned for VariantTy
impl ToOwned for VariantTy
type Owned = VariantType
type Owned = VariantType
The resulting type after obtaining ownership.
sourcefn to_owned(&self) -> VariantType
fn to_owned(&self) -> VariantType
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · sourcefn clone_into(&self, target: &mut Self::Owned)
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
impl RefUnwindSafe for VariantTy
impl Send for VariantTy
impl !Sized for VariantTy
impl Unpin for VariantTy
impl UnwindSafe for VariantTy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToSendValue for T where
T: Send + ToValue + ?Sized,
impl<T> ToSendValue for T where
T: Send + ToValue + ?Sized,
sourcefn to_send_value(&self) -> SendValue
fn to_send_value(&self) -> SendValue
Returns a SendValue
clone of self
.