Skip to main content

VarRecord

Struct VarRecord 

Source
pub struct VarRecord<'a> { /* private fields */ }
Expand description

Zero-copy view of a variable-length MSFT_VarRecord.

The base fixed portion is BASE_SIZE (0x14) bytes. Optional attribute DWORDs follow.

Constructed by VarIter or VarRecord::from_raw.

Implementations§

Source§

impl<'a> VarRecord<'a>

Source

pub const BASE_SIZE: usize = 0x14

Minimum record size (the fixed fields).

Source

pub fn from_raw(bytes: &'a [u8]) -> Result<Self, Error>

Creates a VarRecord from an already-sliced byte buffer.

§Errors

Returns Error::TooShort if bytes.len() < BASE_SIZE.

Source

pub fn as_bytes(&self) -> &'a [u8]

Returns the raw backing bytes.

Source

pub fn info(&self) -> u32

Raw Info field.

Low 8 bits = record size in bytes; upper bits = member index.

Source

pub fn record_size(&self) -> usize

Record size in bytes (low 16 bits of info).

Source

pub fn datatype(&self) -> i32

Variable type (encoded DataType).

Negative values encode simple VT_* types inline. Non-negative values are offsets into the type descriptor table.

Source

pub fn flags(&self) -> u32

VARFLAG_* flags.

Source

pub fn varkind(&self) -> i16

VAR_* kind.

0 = VAR_PERINSTANCE, 2 = VAR_CONST, 3 = VAR_DISPATCH.

Source

pub fn vardesc_size(&self) -> i16

VARDESC size.

Source

pub fn offs_value(&self) -> i32

For VAR_CONST: inline value or offset into the custom data segment. For VAR_PERINSTANCE: byte offset within the instance.

Source

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

Help context (attribute 0, offset 0x14).

Returns None if the record is too short to contain this field.

Source

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

Help string offset (attribute 1, offset 0x18).

Returns None if the record is too short to contain this field.

Source

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

Reserved field (attribute 2, offset 0x1C).

Always -1 in practice. Wine identifies this as res9.

Returns None if the record is too short to contain this field.

Source

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

Offset into the CDGuids directory for this variable’s custom data (attribute 3, offset 0x20).

Returns None if the record is too short to contain this field.

Source

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

Help string context (attribute 4, offset 0x24).

Returns None if the record is too short to contain this field.

Trait Implementations§

Source§

impl<'a> Clone for VarRecord<'a>

Source§

fn clone(&self) -> VarRecord<'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 VarRecord<'a>

Source§

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

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

impl<'a> Copy for VarRecord<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for VarRecord<'a>

§

impl<'a> RefUnwindSafe for VarRecord<'a>

§

impl<'a> Send for VarRecord<'a>

§

impl<'a> Sync for VarRecord<'a>

§

impl<'a> Unpin for VarRecord<'a>

§

impl<'a> UnsafeUnpin for VarRecord<'a>

§

impl<'a> UnwindSafe for VarRecord<'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, 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.