Skip to main content

Replacement

Struct Replacement 

Source
pub struct Replacement {
    pub library: Option<Vec<u8>>,
    pub symbol: Symbol,
    pub replacement: *const c_void,
    pub required: bool,
}
Expand description

A requested slot replacement.

library optionally scopes the match to one providing DLL (case-insensitive); symbol names the import; replacement is the new function pointer. When required is set, install fails if the symbol is not imported by the module; otherwise a missing symbol is silently skipped — the behavior the hookfs install layer needs when applying its superset of candidate hooks.

Fields§

§library: Option<Vec<u8>>

Optional providing-DLL filter (ASCII, case-insensitive).

§symbol: Symbol

The symbol to rebind.

§replacement: *const c_void

The replacement function pointer.

§required: bool

Fail the install if this symbol is not present (vs. skip it).

Implementations§

Source§

impl Replacement

Source

pub fn by_name(library: &str, symbol: &str, replacement: *const c_void) -> Self

A required by-name replacement in a specific library.

Source

pub fn by_symbol(symbol: &str, replacement: *const c_void) -> Self

A required by-name replacement matching the symbol in any providing library — the form the ELF backend uses, where imports are matched by name

Source

pub fn optional(self) -> Self

A replacement that is skipped (not an error) if the symbol is absent.

Trait Implementations§

Source§

impl Debug for Replacement

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Send for Replacement

Replacement holds a raw function pointer, which is !Send by default; the pointer is a process-global code address safe to move between threads.

Source§

impl Sync for Replacement

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.