Struct winsafe::VARIANT

source ·
#[repr(C)]
pub struct VARIANT { /* private fields */ }
Available on crate feature oleaut only.
Expand description

VARIANT struct.

Automatically calls VariantClear when the object goes out of scope.

The Default implementation returns a co::VT::EMPTY value.

Implementations§

source§

impl VARIANT

source

pub fn new_idispatch(val: &impl oleaut_IDispatch) -> Self

Creates a new object holding an IDispatch COM value.

Note that val will be cloned into the VARIANT – that is, IUnknown::AddRef will be called –, so val will remain valid to be used thereafter.

source

pub fn idispatch<T>(&self) -> Option<T>

If the object holds an IDispatch COM value, returns it, otherwise None.

Note that the returned object will be a clone – that is, IUnknown::AddRef will be called.

source

pub fn new_iunknown<T>(val: &impl ole_IUnknown) -> Self

Creates a new object holding an IUnknown COM value.

Note that val will be cloned into the VARIANT – that is, IUnknown::AddRef will be called –, so val will remain valid to be used thereafter.

source

pub fn iunknown<T>(&self) -> Option<T>
where T: ole_IUnknown,

If the object holds an IUnknown COM value, returns it, otherwise None.

Note that the returned object will be a clone – that is, IUnknown::AddRef will be called.

Trait Implementations§

source§

impl Default for VARIANT

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Drop for VARIANT

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl oleaut_Variant for VARIANT

source§

fn raw(&self) -> &[u8; 16]

Returns a reference to the raw data being held. Read more
source§

unsafe fn from_raw(vt: VT, data: &[u8]) -> Self

Creates an object straight from raw data. Up to 16 u8 elements will be actually copied. Read more
source§

fn vt(&self) -> VT

Returns the co::VT variant type currently being held.
source§

fn is_empty(&self) -> bool

Tells whether no value is being held, that is, the variant type is co::VT::EMPTY.
source§

fn is_null(&self) -> bool

Tells whether the object holds an SQL style null, that is, the variant type is co::VT::NULL.
source§

fn new_bool(val: bool) -> Self
where Self: Sized,

Crates a new object holding a bool value.
source§

fn bool(&self) -> Option<bool>

If the object holds a bool value, returns it, otherwise None.
source§

fn new_bstr(val: &str) -> HrResult<Self>
where Self: Sized,

Creates a new object holding a BSTR value.
source§

fn bstr(&self) -> Option<String>

If the object holds a BSTR value, returns it, otherwise None.
source§

fn new_f32(val: f32) -> Self
where Self: Sized,

Creates a new VARIANT holding an f32 value.
source§

fn f32(&self) -> Option<f32>

If the VARIANT holds an f32 value, returns it, otherwise None.
source§

fn new_f64(val: f64) -> Self
where Self: Sized,

Creates a new object holding an f64 value.
source§

fn f64(&self) -> Option<f64>

If the object holds an f64 value, returns it, otherwise None.
source§

fn new_i8(val: i8) -> Self
where Self: Sized,

Creates a new object holding an i8 value.
source§

fn i8(&self) -> Option<i8>

If the object holds an i8 value, returns it, otherwise None.
source§

fn new_i16(val: i16) -> Self
where Self: Sized,

Creates a new object holding an i16 value.
source§

fn i16(&self) -> Option<i16>

If the object holds an i16 value, returns it, otherwise None.
source§

fn new_i32(val: i32) -> Self
where Self: Sized,

Creates a new object holding an i32 value.
source§

fn i32(&self) -> Option<i32>

If the object holds an i32 value, returns it, otherwise None.
source§

fn new_time(val: &SYSTEMTIME) -> SysResult<Self>
where Self: Sized,

Creates a new object holding a date/time value.
source§

fn time(&self) -> Option<SYSTEMTIME>

If the object holds a date/time value, returns it, otherwise None.
source§

fn new_u8(val: u8) -> Self
where Self: Sized,

Creates a new object holding an u8 value.
source§

fn u8(&self) -> Option<u8>

If the object holds an u8 value, returns it, otherwise None.
source§

fn new_u16(val: u16) -> Self
where Self: Sized,

Creates a new object holding an u16 value.
source§

fn u16(&self) -> Option<u16>

If the object holds an u16 value, returns it, otherwise None.
source§

fn new_u32(val: u32) -> Self
where Self: Sized,

Creates a new object holding an u32 value.
source§

fn u32(&self) -> Option<u32>

If the object holds an u32 value, returns it, otherwise None.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.