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: u32Row identifier (1-based index in the table)
token: TokenMetadata token for this LocalConstant entry
offset: usizeByte offset of this row in the original metadata stream
name: u32Index 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: u32Index 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
impl LocalConstantRaw
pub fn to_owned(
&self,
strings: &Strings<'_>,
blobs: &Blob<'_>,
) -> Result<LocalConstantRc>
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 indexblobs: 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
impl Clone for LocalConstantRaw
§fn clone(&self) -> LocalConstantRaw
fn clone(&self) -> LocalConstantRaw
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for LocalConstantRaw
impl Debug for LocalConstantRaw
§impl RowReadable for LocalConstantRaw
impl RowReadable for LocalConstantRaw
§impl RowWritable for LocalConstantRaw
impl RowWritable for LocalConstantRaw
§fn row_write(
&self,
data: &mut [u8],
offset: &mut usize,
_rid: u32,
sizes: &TableInfoRef,
) -> Result<()>
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 streamoffset- Current write position (updated after writing)_rid- Row identifier for this local constant entry (unused forLocalConstant)sizes- Table sizing information for writing heap indexes
§Returns
Ok(())- Successfully serialized local constant rowErr(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:
- Name string index (2/4 bytes, little-endian, 0 = anonymous)
- Signature blob index (2/4 bytes, little-endian)
§impl TableRow for LocalConstantRaw
impl TableRow for LocalConstantRaw
§fn row_size(sizes: &TableInfoRef) -> u32
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§
impl Freeze for LocalConstantRaw
impl RefUnwindSafe for LocalConstantRaw
impl Send for LocalConstantRaw
impl Sync for LocalConstantRaw
impl Unpin for LocalConstantRaw
impl UnwindSafe for LocalConstantRaw
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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