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 ImportScope table for parent scope (may be 0)
  • Imports: Index into #Blob heap for import information

Fields§

§rid: u32

Row identifier (1-based index in the table)

§token: Token

Metadata token for this ImportScope entry

§offset: usize

Byte offset of this row in the original metadata stream

§parent: u32

Index 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: u32

Index 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

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

§

fn clone(&self) -> ImportScopeRaw

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 ImportScopeRaw

§

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

Formats the value using the given formatter. Read more
§

impl RowReadable for ImportScopeRaw

§

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 ImportScopeRaw

§

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 stream
  • offset - Current write position (updated after writing)
  • _rid - Row identifier for this import scope entry (unused for ImportScope)
  • sizes - Table sizing information for writing table and heap indexes
§Returns
  • Ok(()) - Successfully serialized import scope 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. Parent ImportScope index (2/4 bytes, little-endian, 0 = root scope)
  2. Imports blob index (2/4 bytes, little-endian)
§

impl TableRow for ImportScopeRaw

§

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§

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.