gimli::read

Trait ReaderOffset

Source
pub trait ReaderOffset:
    Debug
    + Copy
    + Eq
    + Ord
    + Hash
    + Add<Output = Self>
    + AddAssign
    + Sub<Output = Self> {
    // Required methods
    fn from_u8(offset: u8) -> Self;
    fn from_u16(offset: u16) -> Self;
    fn from_i16(offset: i16) -> Self;
    fn from_u32(offset: u32) -> Self;
    fn from_u64(offset: u64) -> Result<Self>;
    fn into_u64(self) -> u64;
    fn wrapping_add(self, other: Self) -> Self;
    fn checked_sub(self, other: Self) -> Option<Self>;
}
Expand description

A trait for offsets with a DWARF section.

This allows consumers to choose a size that is appropriate for their address space.

Required Methods§

Source

fn from_u8(offset: u8) -> Self

Convert a u8 to an offset.

Source

fn from_u16(offset: u16) -> Self

Convert a u16 to an offset.

Source

fn from_i16(offset: i16) -> Self

Convert an i16 to an offset.

Source

fn from_u32(offset: u32) -> Self

Convert a u32 to an offset.

Source

fn from_u64(offset: u64) -> Result<Self>

Convert a u64 to an offset.

Returns Error::UnsupportedOffset if the value is too large.

Source

fn into_u64(self) -> u64

Convert an offset to a u64.

Source

fn wrapping_add(self, other: Self) -> Self

Wrapping (modular) addition. Computes self + other.

Source

fn checked_sub(self, other: Self) -> Option<Self>

Checked subtraction. Computes self - other.

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.

Implementations on Foreign Types§

Source§

impl ReaderOffset for u32

Source§

fn from_u8(offset: u8) -> Self

Source§

fn from_u16(offset: u16) -> Self

Source§

fn from_i16(offset: i16) -> Self

Source§

fn from_u32(offset: u32) -> Self

Source§

fn from_u64(offset64: u64) -> Result<Self>

Source§

fn into_u64(self) -> u64

Source§

fn wrapping_add(self, other: Self) -> Self

Source§

fn checked_sub(self, other: Self) -> Option<Self>

Source§

impl ReaderOffset for u64

Source§

fn from_u8(offset: u8) -> Self

Source§

fn from_u16(offset: u16) -> Self

Source§

fn from_i16(offset: i16) -> Self

Source§

fn from_u32(offset: u32) -> Self

Source§

fn from_u64(offset: u64) -> Result<Self>

Source§

fn into_u64(self) -> u64

Source§

fn wrapping_add(self, other: Self) -> Self

Source§

fn checked_sub(self, other: Self) -> Option<Self>

Source§

impl ReaderOffset for usize

Source§

fn from_u8(offset: u8) -> Self

Source§

fn from_u16(offset: u16) -> Self

Source§

fn from_i16(offset: i16) -> Self

Source§

fn from_u32(offset: u32) -> Self

Source§

fn from_u64(offset64: u64) -> Result<Self>

Source§

fn into_u64(self) -> u64

Source§

fn wrapping_add(self, other: Self) -> Self

Source§

fn checked_sub(self, other: Self) -> Option<Self>

Implementors§