Struct MethodPtrBuilder
pub struct MethodPtrBuilder { /* private fields */ }Expand description
Builder for constructing MethodPtr table entries
Provides a fluent interface for building MethodPtr metadata table entries.
These entries provide indirection for method access when logical and physical
method ordering differs, enabling method table optimizations and edit-and-continue.
§Required Fields
method: MethodDef table RID that this pointer references
§Indirection Context
The MethodPtr table provides a mapping layer between logical method references and physical MethodDef table entries. This enables:
- Method reordering for metadata optimization
- Edit-and-continue method additions without breaking references
- Runtime method hot-reload and debugging interception
- Incremental compilation with stable method references
§Examples
use dotscope::prelude::*;
// Create method pointer for method reordering
let ptr1 = MethodPtrBuilder::new()
.method(15) // Points to MethodDef table entry 15
.build(&mut context)?;
// Create pointer for hot-reload scenario
let ptr2 = MethodPtrBuilder::new()
.method(42) // Points to MethodDef table entry 42
.build(&mut context)?;
// Multiple pointers for complex reordering
let ptr3 = MethodPtrBuilder::new()
.method(7) // Points to MethodDef table entry 7
.build(&mut context)?;Implementations§
§impl MethodPtrBuilder
impl MethodPtrBuilder
pub fn new() -> Self
pub fn new() -> Self
Creates a new MethodPtrBuilder with default values
Initializes a new builder instance with all fields unset. The caller must provide the required method RID before calling build().
§Returns
A new MethodPtrBuilder instance ready for configuration
§Examples
use dotscope::prelude::*;
let builder = MethodPtrBuilder::new();pub fn method(self, method: u32) -> Self
pub fn method(self, method: u32) -> Self
Sets the MethodDef table RID
Specifies which MethodDef table entry this pointer references. This creates the indirection mapping from the MethodPtr RID (logical index) to the actual MethodDef table entry (physical index).
§Parameters
method: The MethodDef table RID to reference
§Returns
Self for method chaining
§Examples
use dotscope::prelude::*;
// Point to first method
let builder = MethodPtrBuilder::new()
.method(1);
// Point to a later method for reordering
let builder = MethodPtrBuilder::new()
.method(25);pub fn build(self, context: &mut BuilderContext) -> Result<Token>
pub fn build(self, context: &mut BuilderContext) -> Result<Token>
Builds and adds the MethodPtr entry to the metadata
Validates all required fields, creates the MethodPtr table entry,
and adds it to the builder context. Returns a token that can be used
to reference this method pointer entry.
§Parameters
context: Mutable reference to the builder context
§Returns
Ok(Token): Token referencing the created method pointer entryErr(Error): If validation fails or table operations fail
§Errors
- Missing required field (method RID)
- Table operations fail due to metadata constraints
§Examples
use dotscope::prelude::*;
let mut context = BuilderContext::new();
let token = MethodPtrBuilder::new()
.method(8)
.build(&mut context)?;Trait Implementations§
§impl Clone for MethodPtrBuilder
impl Clone for MethodPtrBuilder
§fn clone(&self) -> MethodPtrBuilder
fn clone(&self) -> MethodPtrBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for MethodPtrBuilder
impl Debug for MethodPtrBuilder
§impl Default for MethodPtrBuilder
impl Default for MethodPtrBuilder
§fn default() -> Self
fn default() -> Self
Creates a default MethodPtrBuilder
Equivalent to calling MethodPtrBuilder::new().
Auto Trait Implementations§
impl Freeze for MethodPtrBuilder
impl RefUnwindSafe for MethodPtrBuilder
impl Send for MethodPtrBuilder
impl Sync for MethodPtrBuilder
impl Unpin for MethodPtrBuilder
impl UnwindSafe for MethodPtrBuilder
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