Struct PropertyMapBuilder

pub struct PropertyMapBuilder { /* private fields */ }
Expand description

Builder for creating PropertyMap table entries.

PropertyMapBuilder provides a fluent API for creating entries in the PropertyMap metadata table, which establishes ownership relationships between types and their properties through contiguous ranges of Property table entries.

§Purpose

The PropertyMap table serves several key functions:

  • Property Ownership: Defines which types own which properties
  • Range Management: Establishes contiguous ranges of properties owned by types
  • Efficient Lookup: Enables O(log n) lookup of properties by owning type
  • Property Enumeration: Supports efficient iteration through all properties of a type
  • Metadata Organization: Maintains sorted order for optimal access patterns

§Builder Pattern

The builder provides a fluent interface for constructing PropertyMap entries:


let property_map_token = PropertyMapBuilder::new()
    .parent(type_token)
    .property_list(1) // Starting property index
    .build(&mut context)?;

§Validation

The builder enforces the following constraints:

  • Parent Required: A parent type token must be provided
  • Parent Validation: Parent token must be a valid TypeDef table token
  • Property List Required: A property list starting index must be provided
  • Index Validation: Property list index must be greater than 0
  • Token Validation: Parent token row cannot be 0

§Integration

PropertyMap entries integrate with other metadata structures:

  • TypeDef: References specific types in the TypeDef table as parent
  • Property: Points to starting positions in the Property table for range definition
  • PropertyPtr: Supports indirection through PropertyPtr table when present
  • Metadata Loading: Establishes property ownership during type loading

Implementations§

§

impl PropertyMapBuilder

pub fn new() -> Self

Creates a new PropertyMapBuilder instance.

Returns a builder with all fields unset, ready for configuration through the fluent API methods.

§Examples
let builder = PropertyMapBuilder::new();

pub fn parent(self, parent_token: Token) -> Self

Sets the parent type token that owns the properties.

The parent must be a valid TypeDef token that represents the type that declares and owns the properties in the specified range.

§Arguments
  • parent_token - Token of the TypeDef table entry
§Examples
let type_token = TypeDefBuilder::new()
    .name("PropertyfulClass")
    .namespace("MyApp")
    .public_class()
    .build(&mut context)?;

let builder = PropertyMapBuilder::new()
    .parent(type_token);

pub fn property_list(self, property_list_index: u32) -> Self

Sets the starting index in the Property table for this type’s properties.

This index defines the beginning of the contiguous range of properties owned by the parent type. The range extends to the next PropertyMap entry’s property_list index (or end of Property table for the final entry).

§Arguments
  • property_list_index - 1-based index into the Property table
§Examples
let builder = PropertyMapBuilder::new()
    .property_list(1); // Start from first property

pub fn build(self, context: &mut BuilderContext) -> Result<Token>

Builds the PropertyMap entry and adds it to the assembly.

This method validates all required fields, verifies the parent token is valid, validates the property list index, creates the PropertyMap table entry, and returns the metadata token for the new entry.

§Arguments
  • context - The builder context for the assembly being modified
§Returns

Returns the metadata token for the newly created PropertyMap entry.

§Errors

Returns an error if:

  • The parent token is not set
  • The parent token is not a valid TypeDef token
  • The parent token row is 0
  • The property list index is not set
  • The property list index is 0
  • There are issues adding the table row
§Examples

let property_map_token = PropertyMapBuilder::new()
    .parent(type_token)
    .property_list(1)
    .build(&mut context)?;

println!("Created PropertyMap with token: {}", property_map_token);

Trait Implementations§

§

impl Clone for PropertyMapBuilder

§

fn clone(&self) -> PropertyMapBuilder

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 PropertyMapBuilder

§

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

Formats the value using the given formatter. Read more
§

impl Default for PropertyMapBuilder

§

fn default() -> Self

Returns the “default value” for a type. Read more

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.