#[repr(C)]pub struct Relocation(pub u16);Expand description
Represents a unit of a relocation, which contains a type and an offset in a u16 value.
Tuple Fields§
§0: u16Implementations§
Source§impl Relocation
impl Relocation
Sourcepub fn new(relocation_type: ImageRelBased, offset: u16) -> Self
pub fn new(relocation_type: ImageRelBased, offset: u16) -> Self
Create a new relocation entry.
Sourcepub fn get_type(&self) -> ImageRelBased
pub fn get_type(&self) -> ImageRelBased
Get the type of this relocation.
Sourcepub fn set_type(&mut self, value: ImageRelBased)
pub fn set_type(&mut self, value: ImageRelBased)
Set the type of this relocation.
It is a no-op if you supply ImageRelBased::Unknown.
Sourcepub fn get_offset(&self) -> u16
pub fn get_offset(&self) -> u16
Get the offset of this relocation.
Sourcepub fn set_offset(&mut self, offset: u16)
pub fn set_offset(&mut self, offset: u16)
Set the offset of this relocation.
Sourcepub fn get_address(&self, base: RVA) -> RVA
pub fn get_address(&self, base: RVA) -> RVA
Get the address that this relocation points to.
Sourcepub fn relocate<P: PE>(
&self,
pe: &P,
base_rva: RVA,
new_base: u64,
next_relocation: Option<Relocation>,
) -> Result<RelocationValue, Error>
pub fn relocate<P: PE>( &self, pe: &P, base_rva: RVA, new_base: u64, next_relocation: Option<Relocation>, ) -> Result<RelocationValue, Error>
Get the relocation value of this relocation entry.
If the type of this relocation is ImageRelBased::HighAdj,
next_relocation is required.
Trait Implementations§
Source§impl Clone for Relocation
impl Clone for Relocation
Source§fn clone(&self) -> Relocation
fn clone(&self) -> Relocation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Relocation
impl Debug for Relocation
Source§impl PartialEq for Relocation
impl PartialEq for Relocation
impl Castable for Relocation
impl Copy for Relocation
impl Eq for Relocation
impl StructuralPartialEq for Relocation
Auto Trait Implementations§
impl Freeze for Relocation
impl RefUnwindSafe for Relocation
impl Send for Relocation
impl Sync for Relocation
impl Unpin for Relocation
impl UnwindSafe for Relocation
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
Mutably borrows from an owned value. Read more