pub enum Value {
Empty,
Null,
Bool(bool),
I32(i32),
I64(i64),
NullObject,
U64(u64),
F64(f64),
Str(String),
Object(Box<dyn Dispatch>),
}Expand description
An owned value crossing the COM boundary, mapped from a VARIANT.
Variants§
Empty
VT_EMPTY, an uninitialized VARIANT.
Null
VT_NULL, SQL-style null.
Bool(bool)
VT_BOOL.
I32(i32)
VT_I4, a 32-bit signed integer.
I64(i64)
VT_I8, a 64-bit signed integer (handles, large counts).
NullObject
A null object reference (VT_DISPATCH holding no pointer).
Distinct from Self::Null, which is VT_NULL. A member that takes an
object and documents “pass a null reference” wants this: VT_NULL is a
different type and is refused with DISP_E_TYPEMISMATCH.
U64(u64)
An unsigned 64-bit integer (VT_UI8).
Distinct from Self::I64 because the engine matches numeric
representation strictly: a property stored as unsigned rejects a signed
variant rather than coercing it.
F64(f64)
VT_R8, a 64-bit float.
Str(String)
VT_BSTR, an owned UTF-8 copy of the BSTR.
Object(Box<dyn Dispatch>)
VT_DISPATCH, a nested COM object, ready to wrap.
Implementations§
Source§impl Value
impl Value
Sourcepub const fn as_i32(&self) -> Result<i32, ComError>
pub const fn as_i32(&self) -> Result<i32, ComError>
Reads the value as an i32 (VT_I4).
§Errors
ComError::UnexpectedType if the value is not an Value::I32.
Sourcepub const fn as_i64(&self) -> Result<i64, ComError>
pub const fn as_i64(&self) -> Result<i64, ComError>
Reads the value as an i64 (VT_I8).
§Errors
ComError::UnexpectedType if the value is not an Value::I64.
Sourcepub const fn as_f64(&self) -> Result<f64, ComError>
pub const fn as_f64(&self) -> Result<f64, ComError>
Reads the value as a f64 (VT_R8).
§Errors
ComError::UnexpectedType if the value is not an Value::F64.
Sourcepub const fn as_bool(&self) -> Result<bool, ComError>
pub const fn as_bool(&self) -> Result<bool, ComError>
Reads the value as a bool (VT_BOOL).
§Errors
ComError::UnexpectedType if the value is not a Value::Bool.
Sourcepub fn into_string(self) -> Result<String, ComError>
pub fn into_string(self) -> Result<String, ComError>
Consumes the value as an owned String (VT_BSTR).
§Errors
ComError::UnexpectedType if the value is not a Value::Str.
Sourcepub fn into_object(self) -> Result<Box<dyn Dispatch>, ComError>
pub fn into_object(self) -> Result<Box<dyn Dispatch>, ComError>
Consumes the value as a nested COM object (VT_DISPATCH).
§Errors
ComError::UnexpectedType if the value is not a Value::Object.