Struct druid::piet::cairo::glib::VariantType
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§
§impl VariantType
impl VariantType
pub fn new(type_string: &str) -> Result<VariantType, BoolError>
pub fn new(type_string: &str) -> Result<VariantType, BoolError>
Tries to create a VariantType
from a string slice.
Returns Ok
if the string is a valid type string, Err
otherwise.
pub fn new_dict_entry(
key_type: &VariantTy,
value_type: &VariantTy
) -> VariantType
pub fn new_dict_entry( key_type: &VariantTy, value_type: &VariantTy ) -> VariantType
Creates a VariantType
from a key and value type.
pub fn new_array(elem_type: &VariantTy) -> VariantType
pub fn new_array(elem_type: &VariantTy) -> VariantType
Creates a VariantType
from an array element type.
pub fn new_maybe(child_type: &VariantTy) -> VariantType
pub fn new_maybe(child_type: &VariantTy) -> VariantType
Creates a VariantType
from a maybe element type.
pub fn new_tuple(
items: impl IntoIterator<Item = impl AsRef<VariantTy>>
) -> VariantType
pub fn new_tuple( items: impl IntoIterator<Item = impl AsRef<VariantTy>> ) -> VariantType
Creates a VariantType
from a maybe element type.
pub fn from_string(
type_string: impl Into<GString>
) -> Result<VariantType, BoolError>
pub fn from_string( type_string: impl Into<GString> ) -> Result<VariantType, BoolError>
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>§
pub const BOOLEAN: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BOOLEAN) }
pub const BYTE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BYTE) }
pub const INT16: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_INT16) }
pub const UINT16: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UINT16) }
pub const INT32: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_INT32) }
pub const UINT32: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UINT32) }
pub const INT64: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_INT64) }
pub const UINT64: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UINT64) }
pub const DOUBLE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_DOUBLE) }
pub const STRING: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_STRING) }
pub const OBJECT_PATH: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_OBJECT_PATH) }
pub const SIGNATURE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_SIGNATURE) }
pub const VARIANT: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_VARIANT) }
pub const HANDLE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_HANDLE) }
pub const UNIT: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_UNIT) }
pub const ANY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_ANY) }
pub const BASIC: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BASIC) }
pub const MAYBE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_MAYBE) }
pub const ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_ARRAY) }
pub const TUPLE: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_TUPLE) }
pub const DICT_ENTRY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_DICT_ENTRY) }
pub const DICTIONARY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_DICTIONARY) }
pub const STRING_ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_STRING_ARRAY) }
pub const OBJECT_PATH_ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_OBJECT_PATH_ARRAY) }
pub const BYTE_STRING: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BYTE_STRING) }
pub const BYTE_STRING_ARRAY: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_BYTE_STRING_ARRAY) }
pub const VARDICT: &'static VariantTy = unsafe { VariantTy::from_str_unchecked(ffi::G_VARIANT_TYPE_VARDICT) }
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 Clone for VariantType
impl Clone for VariantType
§fn clone(&self) -> VariantType
fn clone(&self) -> VariantType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for VariantType
impl Debug for VariantType
§impl Deref for VariantType
impl Deref for VariantType
§impl Display for VariantType
impl Display for VariantType
§impl<'a> From<VariantType> for Cow<'a, VariantTy>
impl<'a> From<VariantType> for Cow<'a, VariantTy>
§fn from(ty: VariantType) -> Cow<'a, VariantTy>
fn from(ty: VariantType) -> Cow<'a, VariantTy>
§impl FromStr for VariantType
impl FromStr for VariantType
§impl Hash for VariantType
impl Hash for VariantType
§impl<'a, 'b> PartialEq<&'a VariantTy> for VariantType
impl<'a, 'b> PartialEq<&'a VariantTy> for VariantType
§impl<'a, 'b> PartialEq<&'a str> for VariantType
impl<'a, 'b> PartialEq<&'a str> for VariantType
§impl<'a, 'b> PartialEq<Cow<'a, VariantTy>> for VariantType
impl<'a, 'b> PartialEq<Cow<'a, VariantTy>> for VariantType
§impl<'a, 'b> PartialEq<String> for VariantType
impl<'a, 'b> PartialEq<String> 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
§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 &'a str
impl<'a, 'b> PartialEq<VariantType> for &'a str
§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 Cow<'a, VariantTy>
impl<'a, 'b> PartialEq<VariantType> for Cow<'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 String
impl<'a, 'b> PartialEq<VariantType> for String
§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 PartialEq<VariantType> for VariantType
impl PartialEq<VariantType> for VariantType
§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 str
impl<'a, 'b> PartialEq<VariantType> for str
§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<str> for VariantType
impl<'a, 'b> PartialEq<str> for VariantType
§impl StaticType for VariantType
impl StaticType for VariantType
§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for VariantType
impl Send for VariantType
impl Sync for VariantType
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
§impl<T> StaticTypeExt for Twhere
T: StaticType,
impl<T> StaticTypeExt for Twhere T: StaticType,
§fn ensure_type()
fn ensure_type()
§impl<T> ToClosureReturnValue for Twhere
T: ToValue,
impl<T> ToClosureReturnValue for Twhere T: ToValue,
fn to_closure_return_value(&self) -> Option<Value>
§impl<T> ToSendValue for Twhere
T: Send + ToValue + ?Sized,
impl<T> ToSendValue for Twhere T: Send + ToValue + ?Sized,
§fn to_send_value(&self) -> SendValue
fn to_send_value(&self) -> SendValue
SendValue
clone of self
.