Trait winsafe::prelude::oleaut_Variant

source ·
pub trait oleaut_Variant: Default {
Show 27 methods // Required methods fn raw(&self) -> &[u8; 16]; unsafe fn from_raw(vt: VT, data: &[u8]) -> Self; fn vt(&self) -> VT; // Provided methods fn is_empty(&self) -> bool { ... } fn is_null(&self) -> bool { ... } fn new_bool(val: bool) -> Self where Self: Sized { ... } fn bool(&self) -> Option<bool> { ... } fn new_bstr(val: &str) -> HrResult<Self> where Self: Sized { ... } fn bstr(&self) -> Option<String> { ... } fn new_f32(val: f32) -> Self where Self: Sized { ... } fn f32(&self) -> Option<f32> { ... } fn new_f64(val: f64) -> Self where Self: Sized { ... } fn f64(&self) -> Option<f64> { ... } fn new_i8(val: i8) -> Self where Self: Sized { ... } fn i8(&self) -> Option<i8> { ... } fn new_i16(val: i16) -> Self where Self: Sized { ... } fn i16(&self) -> Option<i16> { ... } fn new_i32(val: i32) -> Self where Self: Sized { ... } fn i32(&self) -> Option<i32> { ... } fn new_time(val: &SYSTEMTIME) -> SysResult<Self> where Self: Sized { ... } fn time(&self) -> Option<SYSTEMTIME> { ... } fn new_u8(val: u8) -> Self where Self: Sized { ... } fn u8(&self) -> Option<u8> { ... } fn new_u16(val: u16) -> Self where Self: Sized { ... } fn u16(&self) -> Option<u16> { ... } fn new_u32(val: u32) -> Self where Self: Sized { ... } fn u32(&self) -> Option<u32> { ... }
}
Available on crate features kernel and oleaut only.
Expand description

This trait is enabled with the oleaut feature, and provides common methods for VARIANT and PROPVARIANT.

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Required Methods§

source

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

Returns a reference to the raw data being held.

This method can be used as an escape hatch to interoperate with other libraries.

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.

This method can be used as an escape hatch to interoperate with other libraries.

§Safety

Be sure the binary data is correct.

source

fn vt(&self) -> VT

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

Provided Methods§

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.

Object Safety§

This trait is not object safe.

Implementors§