Struct DocumentRaw
pub struct DocumentRaw {
pub rid: u32,
pub token: Token,
pub offset: usize,
pub name: u32,
pub hash_algorithm: u32,
pub hash: u32,
pub language: u32,
}Expand description
Raw Document table row with unresolved heap indices
Represents the binary format of a Document metadata table entry (table ID 0x30) as stored in the metadata tables stream. All heap indices are stored as raw values that must be resolved using the appropriate heap context to access the actual data.
The Document table associates source documents with debug information throughout the assembly, providing a mechanism for mapping IL instructions back to source code locations during debugging sessions.
§Reference
Fields§
§rid: u32Row identifier within the Document metadata table
The 1-based index of this document row within the table. Used to generate the metadata token and for table iteration.
token: TokenMetadata token for this document row
Combines the table identifier (0x30 for Document) with the row ID to create
a unique token. Format: 0x30000000 | rid
offset: usizeByte offset of this row within the metadata tables stream
Physical location of the raw document data within the metadata binary format. Used for debugging and low-level metadata analysis.
name: u32Blob heap index for the document name/path (unresolved)
Index into the blob heap containing the document name, typically a file path or URI that identifies the source document. The blob format is specific to document names and may contain path separators and components.
hash_algorithm: u32GUID heap index for the hash algorithm identifier (unresolved)
Index into the GUID heap for the hash algorithm used to compute the document hash. Common algorithms include SHA-1, SHA-256, and others. Must be resolved using GUID heap lookup.
hash: u32Blob heap index for the document content hash (unresolved)
Index into the blob heap containing the hash value of the document content computed using the specified hash algorithm. Used for integrity verification and change detection. A value of 0 indicates no hash is available.
language: u32GUID heap index for the source language identifier (unresolved)
Index into the GUID heap for the programming language used in this document. Common languages include C#, VB.NET, F#, and others. Must be resolved using GUID heap lookup.
Implementations§
§impl DocumentRaw
impl DocumentRaw
pub fn to_owned(
&self,
_strings: &Strings<'_>,
blobs: &Blob<'_>,
guids: &Guid<'_>,
) -> Result<DocumentRc>
pub fn to_owned( &self, _strings: &Strings<'_>, blobs: &Blob<'_>, guids: &Guid<'_>, ) -> Result<DocumentRc>
Convert a raw Document to an owned Document with resolved heap data
This method transforms the raw table entry into a fully usable document by:
- Resolving the name blob to extract the document path
- Resolving the hash algorithm GUID to identify the hash type
- Resolving the hash blob to get the actual hash bytes
- Resolving the language GUID to identify the programming language
- Creating an owned Document with all resolved data
The method performs comprehensive validation to ensure metadata integrity.
§Arguments
strings- String heap for resolving string indicesblobs- Blob heap for resolving blob indices (name and hash)guids- GUID heap for resolving GUID indices (hash algorithm and language)
§Returns
Returns Ok(DocumentRc) with the resolved document data, or an error if:
- Any heap index is invalid or out of bounds
- The document name blob has an invalid format
- Required heap data is missing or corrupted
§Errors
Returns an error if:
- Blob heap access fails for name or hash data
- GUID heap access fails for hash algorithm or language GUIDs
- Any heap index is out of bounds
§Example
let document_raw = DocumentRaw {
rid: 1,
token: Token::new(0x30000001),
offset: 0,
name: 42, // blob index
hash_algorithm: 1, // GUID index
hash: 100, // blob index
language: 1, // GUID index
};
// let document = document_raw.to_owned(&strings, &blobs, &guids)?;§Errors
Returns an error if heap lookups fail or if the data is malformed.
Trait Implementations§
§impl Clone for DocumentRaw
impl Clone for DocumentRaw
§fn clone(&self) -> DocumentRaw
fn clone(&self) -> DocumentRaw
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for DocumentRaw
impl Debug for DocumentRaw
§impl RowReadable for DocumentRaw
impl RowReadable for DocumentRaw
§impl RowWritable for DocumentRaw
impl RowWritable for DocumentRaw
§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 Document table row to binary data
Serializes one Document table entry to the metadata tables stream format, handling
variable-width 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 document entry (unused forDocument)sizes- Table sizing information for writing heap indexes
§Returns
Ok(())- Successfully serialized document 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 blob index (2/4 bytes, little-endian)
- Hash algorithm GUID index (2/4 bytes, little-endian)
- Hash blob index (2/4 bytes, little-endian)
- Language GUID index (2/4 bytes, little-endian)
§impl TableRow for DocumentRaw
impl TableRow for DocumentRaw
§fn row_size(sizes: &TableInfoRef) -> u32
fn row_size(sizes: &TableInfoRef) -> u32
Calculate the row size for Document table entries
Returns the total byte size of a single Document table row based on the
table configuration. The size varies depending on the size of heap indexes in the metadata.
§Size Breakdown
name: 2 or 4 bytes (blob heap index for document name/path)hash_algorithm: 2 or 4 bytes (GUID heap index for hash algorithm)hash: 2 or 4 bytes (blob heap index for document content hash)language: 2 or 4 bytes (GUID heap index for source language)
Total: 8-16 bytes depending on heap size configuration
Auto Trait Implementations§
impl Freeze for DocumentRaw
impl RefUnwindSafe for DocumentRaw
impl Send for DocumentRaw
impl Sync for DocumentRaw
impl Unpin for DocumentRaw
impl UnwindSafe for DocumentRaw
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