Trait ResolvableAddress

Source
pub trait ResolvableAddress {
    // Required method
    fn offset(&self) -> Result<NonZeroUsize, DataBaseError>;

    // Provided methods
    fn address(&self) -> Result<NonNull<c_void>, DataBaseError> { ... }
    fn base() -> Result<NonNull<c_void>, ModuleStateError> { ... }
}
Expand description

A trait for resolving an absolute address based on an offset.

Implementing types must provide an offset() method that returns the offset used to compute the final address.

The base address is retrieved using the base() method, which fetches the module’s base address.

§Errors

  • If the offset cannot be resolved, offset() returns a DataBaseError.
  • If the base address cannot be retrieved, base() returns a ModuleStateError.

Required Methods§

Source

fn offset(&self) -> Result<NonZeroUsize, DataBaseError>

Returns the offset associated with this instance.

§Errors

Returns an error if the offset cannot be determined.

Provided Methods§

Source

fn address(&self) -> Result<NonNull<c_void>, DataBaseError>

Computes the absolute address by adding the offset to the module’s base address.

§Errors
  • If the offset is 0.
  • Returns DataBaseError if the offset cannot be determined.
  • Returns ModuleStateError if the base address is unavailable.
Source

fn base() -> Result<NonNull<c_void>, ModuleStateError>

Retrieves the base address of the module.

§Errors

Returns an error if the module is in an invalid state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§