Struct LocalConstantRaw

pub struct LocalConstantRaw {
    pub rid: u32,
    pub token: Token,
    pub offset: usize,
    pub name: u32,
    pub signature: u32,
}
Expand description

Raw binary representation of a LocalConstant table entry

This structure matches the exact binary layout of LocalConstant table entries in the metadata tables stream. Both Name and Signature fields contain unresolved indices into their respective heaps that must be resolved during conversion to the owned LocalConstant variant.

§Binary Format

Each LocalConstant table entry consists of:

  • Name: Index into #Strings heap for the constant name
  • Signature: Index into #Blob heap for the constant signature

Fields§

§rid: u32

Row identifier (1-based index in the table)

§token: Token

Metadata token for this LocalConstant entry

§offset: usize

Byte offset of this row in the original metadata stream

§name: u32

Index into #Strings heap for constant name

Points to the constant’s name string in the metadata #Strings heap. This index must be resolved to get the actual constant name string. May be 0 for anonymous or compiler-generated constants.

§signature: u32

Index into #Blob heap for constant signature

Points to the constant’s signature blob in the metadata #Blob heap. The signature describes the constant’s type and value information. This index must be resolved to get the actual signature data.

Implementations§

§

impl LocalConstantRaw

pub fn to_owned( &self, strings: &Strings<'_>, blobs: &Blob<'_>, ) -> Result<LocalConstantRc>

Converts this raw LocalConstant entry to an owned LocalConstant instance

This method resolves the raw LocalConstant entry to create a complete LocalConstant object by resolving the name string from the #Strings heap and signature data from the #Blob heap.

§Parameters
  • strings: Reference to the #Strings heap for resolving the name index
  • blobs: Reference to the #Blob heap for resolving the signature index
§Returns

Returns Ok(LocalConstantRc) with the resolved constant data, or an error if the name or signature indices are invalid or point to malformed data.

§Errors

Returns an error if the name or signature indices are invalid or if the data is malformed.

§Example
let constant_raw = LocalConstantRaw {
    rid: 1,
    token: Token::new(0x34000001),
    offset: 0,
    name: 42,           // Index into #Strings heap
    signature: 100,     // Index into #Blob heap
};

let constant = constant_raw.to_owned(strings, blobs)?;

Trait Implementations§

§

impl Clone for LocalConstantRaw

§

fn clone(&self) -> LocalConstantRaw

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
§

impl Debug for LocalConstantRaw

§

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

Formats the value using the given formatter. Read more
§

impl RowReadable for LocalConstantRaw

§

fn row_read( data: &[u8], offset: &mut usize, rid: u32, sizes: &TableInfoRef, ) -> Result<Self>

Reads and parses a single row from the provided byte buffer. Read more
§

impl RowWritable for LocalConstantRaw

§

fn row_write( &self, data: &mut [u8], offset: &mut usize, _rid: u32, sizes: &TableInfoRef, ) -> Result<()>

Write a LocalConstant table row to binary data

Serializes one LocalConstant table entry to the metadata tables stream format, handling variable-width string and blob heap indexes based on the heap size information.

§Arguments
  • data - Target binary buffer for metadata tables stream
  • offset - Current write position (updated after writing)
  • _rid - Row identifier for this local constant entry (unused for LocalConstant)
  • sizes - Table sizing information for writing heap indexes
§Returns
  • Ok(()) - Successfully serialized local constant row
  • Err(crate::Error) - If buffer is too small or write fails
§Binary Format

Fields are written in the exact order specified by the Portable PDB specification:

  1. Name string index (2/4 bytes, little-endian, 0 = anonymous)
  2. Signature blob index (2/4 bytes, little-endian)
§

impl TableRow for LocalConstantRaw

§

fn row_size(sizes: &TableInfoRef) -> u32

Calculate the byte size of a LocalConstant table row

Returns the total size of one row in the LocalConstant table, including:

  • name: 2 or 4 bytes (String heap index)
  • signature: 2 or 4 bytes (Blob heap index)

The index sizes depend on the metadata heap requirements.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.