Struct dynasmrt::components::ManagedRelocs

source ·
pub struct ManagedRelocs<R: Relocation> { /* private fields */ }
Expand description

A registry of relocations that have been encoded previously, but need to be adjusted when the address of the buffer they reside in changes.

Implementations§

source§

impl<R: Relocation> ManagedRelocs<R>

source

pub fn new() -> Self

Create a new, empty managed relocation registry.

source

pub fn add(&mut self, patchloc: PatchLoc<R>)

Add a relocation to this registry.

source

pub fn append(&mut self, other: &mut ManagedRelocs<R>)

Take all items from another registry and add them to this registry

source

pub fn remove_between(&mut self, start: usize, end: usize)

Remove all managed relocations whose byte fields start in the range start .. end. This is useful when implementing an Assembler::alter API, as any managed relocations that were overwritten should be removed from the registry, otherwise the replacement code would be corrupted when managed relocations are updated.

source

pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a PatchLoc<R>> + 'a

Iterate through all defined managed relocations.

Trait Implementations§

source§

impl<R: Debug + Relocation> Debug for ManagedRelocs<R>

source§

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

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

impl<R: Default + Relocation> Default for ManagedRelocs<R>

source§

fn default() -> ManagedRelocs<R>

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

Auto Trait Implementations§

§

impl<R> Freeze for ManagedRelocs<R>

§

impl<R> RefUnwindSafe for ManagedRelocs<R>
where R: RefUnwindSafe,

§

impl<R> Send for ManagedRelocs<R>
where R: Send,

§

impl<R> Sync for ManagedRelocs<R>
where R: Sync,

§

impl<R> Unpin for ManagedRelocs<R>

§

impl<R> UnwindSafe for ManagedRelocs<R>
where R: RefUnwindSafe,

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>,

§

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>,

§

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.