pub struct Variant<D, T>where
D: VariantExt<T>,{ /* private fields */ }
Expand description
Container for variant-compatible types. Wrap them with this so that the output VARIANT structure has vt == VT_VARIANT and the data is a *mut VARIANT.
Example
extern crate oaidl;
use oaidl::{ConversionError, Variant, VariantExt};
fn main() -> Result<(), ConversionError> {
let val = 1337u16;
let val = Variant::wrap(val);
// convert into a Ptr<VARIANT> as per usual.
Ok(())
}
Implementations§
Trait Implementations§
source§impl<D, T: Ord> Ord for Variant<D, T>where
D: VariantExt<T> + Ord,
impl<D, T: Ord> Ord for Variant<D, T>where
D: VariantExt<T> + Ord,
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<D, T: PartialEq> PartialEq<Variant<D, T>> for Variant<D, T>where
D: VariantExt<T> + PartialEq,
impl<D, T: PartialEq> PartialEq<Variant<D, T>> for Variant<D, T>where
D: VariantExt<T> + PartialEq,
source§impl<D, T: PartialOrd> PartialOrd<Variant<D, T>> for Variant<D, T>where
D: VariantExt<T> + PartialOrd,
impl<D, T: PartialOrd> PartialOrd<Variant<D, T>> for Variant<D, T>where
D: VariantExt<T> + PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<D, T> TryConvert<Ptr<VARIANT>, ElementError> for Variant<D, T>where
D: VariantExt<T>,
impl<D, T> TryConvert<Ptr<VARIANT>, ElementError> for Variant<D, T>where
D: VariantExt<T>,
source§fn try_convert(ptr: Ptr<VARIANT>) -> Result<Self, ElementError>
fn try_convert(ptr: Ptr<VARIANT>) -> Result<Self, ElementError>
Converts a Ptr<VARIANT>
to a Variant<D, T>
where D: VariantExt<T>
source§impl<D, T> TryConvert<Ptr<VARIANT>, FromVariantError> for Variant<D, T>where
D: VariantExt<T>,
impl<D, T> TryConvert<Ptr<VARIANT>, FromVariantError> for Variant<D, T>where
D: VariantExt<T>,
source§fn try_convert(ptr: Ptr<VARIANT>) -> Result<Self, FromVariantError>
fn try_convert(ptr: Ptr<VARIANT>) -> Result<Self, FromVariantError>
Converts a Ptr<VARIANT>
to a Variant<D, T>
where D: VariantExt<T>
source§impl<D, T> TryConvert<Variant<D, T>, ElementError> for Ptr<VARIANT>where
D: VariantExt<T>,
impl<D, T> TryConvert<Variant<D, T>, ElementError> for Ptr<VARIANT>where
D: VariantExt<T>,
source§fn try_convert(v: Variant<D, T>) -> Result<Self, ElementError>
fn try_convert(v: Variant<D, T>) -> Result<Self, ElementError>
Converts a Variant<D, T>
to a Ptr<VARIANT>
where D: VariantExt<T>
This converts the value inside Variant into a Ptr
source§impl<D, T> TryConvert<Variant<D, T>, IntoVariantError> for Ptr<VARIANT>where
D: VariantExt<T>,
impl<D, T> TryConvert<Variant<D, T>, IntoVariantError> for Ptr<VARIANT>where
D: VariantExt<T>,
source§fn try_convert(v: Variant<D, T>) -> Result<Self, IntoVariantError>
fn try_convert(v: Variant<D, T>) -> Result<Self, IntoVariantError>
Converts a Variant<D, T>
to a Ptr<VARIANT>
where D: VariantExt<T>
This converts the value inside Variant into a Ptr
impl<D, T: Copy> Copy for Variant<D, T>where
D: VariantExt<T> + Copy,
impl<D, T: Eq> Eq for Variant<D, T>where
D: VariantExt<T> + Eq,
impl<D, T> SafeArrayElement for Variant<D, T>where
D: VariantExt<T>,
SafeArrayElementimpl for ['Variant<D,T>']. This allows it to be converted into SAFEARRAY with vt =
VT_VARIANT. This overrides the default impl of
from_safearrayand
into_safearraybecause
*mut VARIANTdoesn't need an additional indirection to be put into a
SAFEARRAY`.