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`.
impl<D, T> StructuralEq for Variant<D, T>where D: VariantExt<T>,
impl<D, T> StructuralPartialEq for Variant<D, T>where D: VariantExt<T>,
Auto Trait Implementations§
impl<D, T> RefUnwindSafe for Variant<D, T>where D: RefUnwindSafe, T: RefUnwindSafe,
impl<D, T> Send for Variant<D, T>where D: Send, T: Send,
impl<D, T> Sync for Variant<D, T>where D: Sync, T: Sync,
impl<D, T> Unpin for Variant<D, T>where D: Unpin, T: Unpin,
impl<D, T> UnwindSafe for Variant<D, T>where D: UnwindSafe, T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, F> TryConvert<T, F> for Twhere
T: From<T>,
F: Fail,
impl<T, F> TryConvert<T, F> for Twhere T: From<T>, F: Fail,
source§fn try_convert(val: T) -> Result<T, F>
fn try_convert(val: T) -> Result<T, F>
Blanket TryConvert implementation wherever a From
source§impl<OutTy, InTy> VariantExt<InTy> for OutTywhere
OutTy: TryConvert<InTy, FromVariantError> + VariantAccess<Field = InTy>,
InTy: TryConvert<OutTy, IntoVariantError>,
impl<OutTy, InTy> VariantExt<InTy> for OutTywhere OutTy: TryConvert<InTy, FromVariantError> + VariantAccess<Field = InTy>, InTy: TryConvert<OutTy, IntoVariantError>,
source§fn from_variant(pvar: Ptr<VARIANT>) -> Result<OutTy, FromVariantError>
fn from_variant(pvar: Ptr<VARIANT>) -> Result<OutTy, FromVariantError>
Ptr<VARIANT>
to obtain a value T
source§fn into_variant(value: OutTy) -> Result<Ptr<VARIANT>, IntoVariantError>
fn into_variant(value: OutTy) -> Result<Ptr<VARIANT>, IntoVariantError>
T
into a Ptr<VARIANT>