Skip to main content

ConstValue

Enum ConstValue 

Source
#[non_exhaustive]
pub enum ConstValue<'a> {
Show 24 variants Empty, Null, I2(i16), I4(i32), R4(f32), R8(f64), Cy(i64), Date(f64), Bstr(&'a [u8]), Error(i32), Bool(bool), I1(i8), UI1(u8), UI2(u16), UI4(u32), I8(i64), UI8(u64), Int(i32), UInt(u32), Void, Hresult(i32), Decimal(&'a [u8]), Filetime(u64), Raw { vt: u16, bits: i32, },
}
Expand description

A decoded constant value from a VAR_CONST variable record or custom data.

Values are either packed inline in the OffsValue field (small positive integers) or stored in the custom data segment.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Empty

No value / empty (VT_EMPTY, 0).

§

Null

Null (VT_NULL, 1).

§

I2(i16)

A 16-bit signed integer (VT_I2, 2).

§

I4(i32)

A 32-bit signed integer (VT_I4, 3).

§

R4(f32)

A 32-bit float (VT_R4, 4).

§

R8(f64)

A 64-bit float (VT_R8, 5).

§

Cy(i64)

A currency value (VT_CY, 6) stored as a 64-bit integer scaled by 10000.

§

Date(f64)

A date (VT_DATE, 7) stored as a 64-bit float (OLE Automation date).

§

Bstr(&'a [u8])

A byte-string (VT_BSTR, 8), borrowed from the file data.

§

Error(i32)

An OLE error code (VT_ERROR, 10).

§

Bool(bool)

A boolean (VT_BOOL, 11).

§

I1(i8)

A signed byte (VT_I1, 16).

§

UI1(u8)

An unsigned byte (VT_UI1, 17).

§

UI2(u16)

An unsigned 16-bit integer (VT_UI2, 18).

§

UI4(u32)

An unsigned 32-bit integer (VT_UI4, 19).

§

I8(i64)

A 64-bit signed integer (VT_I8, 20).

§

UI8(u64)

A 64-bit unsigned integer (VT_UI8, 21).

§

Int(i32)

A signed integer (VT_INT, 22).

§

UInt(u32)

An unsigned integer (VT_UINT, 23).

§

Void

Void (VT_VOID, 24).

§

Hresult(i32)

An HRESULT (VT_HRESULT, 25).

§

Decimal(&'a [u8])

A decimal value (VT_DECIMAL, 14), raw 16 bytes.

§

Filetime(u64)

A FILETIME value (VT_FILETIME, 64).

§

Raw

A value whose VARTYPE code has no dedicated variant above.

The vt field is the 16-bit VARTYPE code (e.g. VT_DISPATCH = 9, VT_VARIANT = 12). The bits field is the first 4 bytes of the value payload; for wider types the remaining bytes are not captured.

Fields

§vt: u16

The VARTYPE code.

§bits: i32

The first 4 bytes of the value payload, read as a little-endian i32.

Trait Implementations§

Source§

impl<'a> Clone for ConstValue<'a>

Source§

fn clone(&self) -> ConstValue<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ConstValue<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ConstValue<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ConstValue<'a>

§

impl<'a> RefUnwindSafe for ConstValue<'a>

§

impl<'a> Send for ConstValue<'a>

§

impl<'a> Sync for ConstValue<'a>

§

impl<'a> Unpin for ConstValue<'a>

§

impl<'a> UnsafeUnpin for ConstValue<'a>

§

impl<'a> UnwindSafe for ConstValue<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.