pub struct Relocation(/* private fields */);Expand description
A relocation entry
It roughly follows the Relocation struct from the object crate,
with some simplifications.
Represents a bitfield.
Implementations§
Source§impl Relocation
impl Relocation
Sourcepub const OFFSET_BITS: u32 = 16u32
pub const OFFSET_BITS: u32 = 16u32
The number of bits offset occupies in the bitfield.
Sourcepub const OFFSET_OFFSET: u32 = 0u32
pub const OFFSET_OFFSET: u32 = 0u32
The bitfield start bit of offset.
Sourcepub const ENCODING_BITS: u32 = 7u32
pub const ENCODING_BITS: u32 = 7u32
The number of bits encoding occupies in the bitfield.
Sourcepub const ENCODING_OFFSET: u32 = 16u32
pub const ENCODING_OFFSET: u32 = 16u32
The bitfield start bit of encoding.
Sourcepub const RELATIVE_BITS: u32 = 1u32
pub const RELATIVE_BITS: u32 = 1u32
The number of bits relative occupies in the bitfield.
Sourcepub const RELATIVE_OFFSET: u32 = 23u32
pub const RELATIVE_OFFSET: u32 = 23u32
The bitfield start bit of relative.
Sourcepub const SIZE_OFFSET: u32 = 24u32
pub const SIZE_OFFSET: u32 = 24u32
The bitfield start bit of size.
Sourcepub const ADDEND_BITS: u32 = 12u32
pub const ADDEND_BITS: u32 = 12u32
The number of bits addend occupies in the bitfield.
Sourcepub const ADDEND_OFFSET: u32 = 32u32
pub const ADDEND_OFFSET: u32 = 32u32
The bitfield start bit of addend.
Sourcepub const PATCH_KIND_BITS: u32 = 4u32
pub const PATCH_KIND_BITS: u32 = 4u32
The number of bits patch_kind occupies in the bitfield.
Sourcepub const PATCH_KIND_OFFSET: u32 = 44u32
pub const PATCH_KIND_OFFSET: u32 = 44u32
The bitfield start bit of patch_kind.
Sourcepub const PATCH_ID_BITS: u32 = 16u32
pub const PATCH_ID_BITS: u32 = 16u32
The number of bits patch_id occupies in the bitfield.
Sourcepub const PATCH_ID_OFFSET: u32 = 48u32
pub const PATCH_ID_OFFSET: u32 = 48u32
The bitfield start bit of patch_id.
Sourcepub const fn new_without_defaults() -> Self
pub const fn new_without_defaults() -> Self
Creates a new bitfield instance without setting any default values.
Sourcepub const fn from_bits_with_defaults(bits: u64) -> Self
pub const fn from_bits_with_defaults(bits: u64) -> Self
Creates a new bitfield instance from the given bits while respecting field default values.
Sourcepub const fn encoding(&self) -> RelocationEncoding
pub const fn encoding(&self) -> RelocationEncoding
Returns bits 16..=22.
Sourcepub const fn patch_kind(&self) -> PatchKind
pub const fn patch_kind(&self) -> PatchKind
Returns bits 44..=47.
Sourcepub const fn set_offset(&mut self, bits: u16)
pub const fn set_offset(&mut self, bits: u16)
Sets bits 0..=15.
Sourcepub const fn checked_set_offset(
&mut self,
bits: u16,
) -> Result<(), &'static str>
pub const fn checked_set_offset( &mut self, bits: u16, ) -> Result<(), &'static str>
Sets bits 0..=15. Returns an error if the value is too big to fit within the field bits.
Sourcepub const fn set_encoding(&mut self, bits: RelocationEncoding)
pub const fn set_encoding(&mut self, bits: RelocationEncoding)
Sets bits 16..=22.
Sourcepub const fn checked_set_encoding(
&mut self,
bits: RelocationEncoding,
) -> Result<(), &'static str>
pub const fn checked_set_encoding( &mut self, bits: RelocationEncoding, ) -> Result<(), &'static str>
Sets bits 16..=22. Returns an error if the value is too big to fit within the field bits.
Sourcepub const fn set_relative(&mut self, bits: bool)
pub const fn set_relative(&mut self, bits: bool)
Sets bit 23.
Sourcepub const fn checked_set_relative(
&mut self,
bits: bool,
) -> Result<(), &'static str>
pub const fn checked_set_relative( &mut self, bits: bool, ) -> Result<(), &'static str>
Sets bit 23. Returns an error if the value is too big to fit within the field bit.
Sourcepub const fn checked_set_size(&mut self, bits: u8) -> Result<(), &'static str>
pub const fn checked_set_size(&mut self, bits: u8) -> Result<(), &'static str>
Sets bits 24..=31. Returns an error if the value is too big to fit within the field bits.
Sourcepub const fn set_addend(&mut self, bits: i16)
pub const fn set_addend(&mut self, bits: i16)
Sets bits 32..=43.
Sourcepub const fn checked_set_addend(
&mut self,
bits: i16,
) -> Result<(), &'static str>
pub const fn checked_set_addend( &mut self, bits: i16, ) -> Result<(), &'static str>
Sets bits 32..=43. Returns an error if the value is too big to fit within the field bits.
Sourcepub const fn set_patch_kind(&mut self, bits: PatchKind)
pub const fn set_patch_kind(&mut self, bits: PatchKind)
Sets bits 44..=47.
Sourcepub const fn checked_set_patch_kind(
&mut self,
bits: PatchKind,
) -> Result<(), &'static str>
pub const fn checked_set_patch_kind( &mut self, bits: PatchKind, ) -> Result<(), &'static str>
Sets bits 44..=47. Returns an error if the value is too big to fit within the field bits.
Sourcepub const fn set_patch_id(&mut self, bits: u16)
pub const fn set_patch_id(&mut self, bits: u16)
Sets bits 48..=63.
Sourcepub const fn checked_set_patch_id(
&mut self,
bits: u16,
) -> Result<(), &'static str>
pub const fn checked_set_patch_id( &mut self, bits: u16, ) -> Result<(), &'static str>
Sets bits 48..=63. Returns an error if the value is too big to fit within the field bits.
Sourcepub fn set_bits_with_defaults(&mut self, bits: u64)
pub fn set_bits_with_defaults(&mut self, bits: u64)
Sets the writable bits of the bitfield while respecting defaults.
Sourcepub fn clear_bits(&mut self)
pub fn clear_bits(&mut self)
Clears the writable bits of the bitfield.
Sourcepub fn clear_bits_with_defaults(&mut self)
pub fn clear_bits_with_defaults(&mut self)
Clears the writable bits of the bitfield.
Source§impl Relocation
impl Relocation
pub fn is_invalid(&self) -> bool
pub fn patch_info(&self) -> Option<PatchInfo>
pub fn supports_value(&self, value: usize) -> bool
pub fn apply_raw(&self, dest: &mut [u8], value: usize)
Trait Implementations§
Source§impl Clone for Relocation
impl Clone for Relocation
Source§fn clone(&self) -> Relocation
fn clone(&self) -> Relocation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more