Struct ImportScopeRaw
pub struct ImportScopeRaw {
pub rid: u32,
pub token: Token,
pub offset: usize,
pub parent: u32,
pub imports: u32,
}Expand description
Raw binary representation of an ImportScope table entry
This structure matches the exact binary layout of ImportScope table
entries in the metadata tables stream. The Parent field contains an
unresolved index to another ImportScope entry, and the Imports field contains
an unresolved index into the #Blob heap that must be resolved during
conversion to the owned ImportScope variant.
§Binary Format
Each ImportScope table entry consists of:
- Parent: Index into
ImportScopetable for parent scope (may be 0) - Imports: Index into #Blob heap for import information
Fields§
§rid: u32Row identifier (1-based index in the table)
token: TokenMetadata token for this ImportScope entry
offset: usizeByte offset of this row in the original metadata stream
parent: u32Index into ImportScope table for parent scope
Points to the parent import scope that encloses this scope, or 0 if this is a root-level import scope. Import scopes form a tree structure where child scopes inherit imports from their parent scopes.
imports: u32Index into #Blob heap for import information
Points to the binary blob containing the import data for this scope. The blob format contains the list of imported namespaces and types that are available within this lexical scope.
Implementations§
§impl ImportScopeRaw
impl ImportScopeRaw
pub fn to_owned(&self, blobs: &Blob<'_>) -> Result<ImportScopeRc>
pub fn to_owned(&self, blobs: &Blob<'_>) -> Result<ImportScopeRc>
Converts this raw ImportScope entry to an owned ImportScope instance
This method resolves the raw ImportScope entry to create a complete ImportScope
object by resolving the imports blob data from the #Blob heap. The parent
reference is kept as an index that can be resolved through the ImportScope table.
§Parameters
blobs: Reference to the #Blob heap for resolving the imports index
§Returns
Returns Ok(ImportScopeRc) with the resolved import scope data, or an error if
the imports index is invalid or points to malformed data.
§Example
let scope_raw = ImportScopeRaw {
rid: 1,
token: Token::new(0x35000001),
offset: 0,
parent: 0, // Root scope
imports: 100, // Index into #Blob heap
};
let scope = scope_raw.to_owned(blobs)?;§Errors
Returns an error if the blob index is invalid, the blob cannot be parsed, or memory allocation fails during conversion.
Trait Implementations§
§impl Clone for ImportScopeRaw
impl Clone for ImportScopeRaw
§fn clone(&self) -> ImportScopeRaw
fn clone(&self) -> ImportScopeRaw
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ImportScopeRaw
impl Debug for ImportScopeRaw
§impl RowReadable for ImportScopeRaw
impl RowReadable for ImportScopeRaw
§impl RowWritable for ImportScopeRaw
impl RowWritable for ImportScopeRaw
§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 an ImportScope table row to binary data
Serializes one ImportScope table entry to the metadata tables stream format, handling
variable-width table and blob heap indexes based on the table and heap size information.
§Arguments
data- Target binary buffer for metadata tables streamoffset- Current write position (updated after writing)_rid- Row identifier for this import scope entry (unused forImportScope)sizes- Table sizing information for writing table and heap indexes
§Returns
Ok(())- Successfully serialized import scope 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:
- Parent ImportScope index (2/4 bytes, little-endian, 0 = root scope)
- Imports blob index (2/4 bytes, little-endian)
§impl TableRow for ImportScopeRaw
impl TableRow for ImportScopeRaw
§fn row_size(sizes: &TableInfoRef) -> u32
fn row_size(sizes: &TableInfoRef) -> u32
Calculate the byte size of an ImportScope table row
Returns the total size of one row in the ImportScope table, including:
- parent: 2 or 4 bytes (ImportScope table index)
- imports: 2 or 4 bytes (Blob heap index)
The index sizes depend on the metadata table and heap requirements.
Auto Trait Implementations§
impl Freeze for ImportScopeRaw
impl RefUnwindSafe for ImportScopeRaw
impl Send for ImportScopeRaw
impl Sync for ImportScopeRaw
impl Unpin for ImportScopeRaw
impl UnwindSafe for ImportScopeRaw
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