Struct gmime::Variant [−]
pub struct Variant(_);
A generic immutable value capable of carrying various types.
See the module documentation for more details.
Methods
impl Variant
impl Variant
pub fn type_(&self) -> &VariantTy
pub fn type_(&self) -> &VariantTy
Returns the type of the value.
pub fn is<T>(&self) -> bool where
T: StaticVariantType,
pub fn is<T>(&self) -> bool where
T: StaticVariantType,
Returns true
if the type of the value corresponds to T
.
pub fn get<T>(&self) -> Option<T> where
T: FromVariant,
pub fn get<T>(&self) -> Option<T> where
T: FromVariant,
Tries to extract a value of type T
.
Returns Some
if T
matches the variant's type.
pub fn get_str(&self) -> Option<&str>
pub fn get_str(&self) -> Option<&str>
Tries to extract a &str
.
Returns Some
if the variant has a string type (s
, o
or g
type
strings).
Trait Implementations
impl Sync for Variant
impl Sync for Variant
impl Hash for Variant
impl Hash for Variant
fn hash<H>(&self, state: &mut H) where
H: Hasher,
fn hash<H>(&self, state: &mut H) where
H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq<Variant> for Variant
impl PartialEq<Variant> for Variant
fn eq(&self, other: &Variant) -> bool
fn eq(&self, other: &Variant) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Variant
impl Eq for Variant
impl Clone for Variant
impl Clone for Variant
fn clone(&self) -> Variant
fn clone(&self) -> Variant
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Variant
impl Debug for Variant
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<T> From<T> for Variant where
T: ToVariant,
impl<T> From<T> for Variant where
T: ToVariant,
impl Display for Variant
impl Display for Variant
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl StaticType for Variant
impl StaticType for Variant
fn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of Self
.
impl Send for Variant
impl Send for Variant