pub struct Variant(_);
Expand description
A generic immutable value capable of carrying various types.
See the module documentation for more details.
Implementations
sourceimpl Variant
impl Variant
sourcepub fn is<T: StaticVariantType>(&self) -> bool
pub fn is<T: StaticVariantType>(&self) -> bool
Returns true
if the type of the value corresponds to T
.
sourcepub fn get<T: FromVariant>(&self) -> Option<T>
pub fn get<T: FromVariant>(&self) -> Option<T>
Tries to extract a value of type T
.
Returns Some
if T
matches the variant’s type.
Trait Implementations
sourceimpl PartialOrd<Variant> for Variant
impl PartialOrd<Variant> for Variant
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresourceimpl StaticType for Variant
impl StaticType for Variant
sourcefn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of
Self
.impl Eq for Variant
impl Send for Variant
impl Sync for Variant
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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 Twhere
T: SetValue + Send + ToValue + ?Sized,
impl<T> ToSendValue for Twhere
T: SetValue + Send + ToValue + ?Sized,
sourcefn to_send_value(&self) -> SendValue
fn to_send_value(&self) -> SendValue
Returns a
SendValue
clone of self
.