#[repr(C)]
pub struct ProgramHeader { pub p_type: u32, pub p_offset: u32, pub p_vaddr: u32, pub p_paddr: u32, pub p_filesz: u32, pub p_memsz: u32, pub p_flags: u32, pub p_align: u32, }
Expand description

A 32-bit ProgramHeader typically specifies how to map executable and data segments into memory

Fields§

§p_type: u32

Segment type

§p_offset: u32

Segment file offset

§p_vaddr: u32

Segment virtual address

§p_paddr: u32

Segment physical address

§p_filesz: u32

Segment size in file

§p_memsz: u32

Segment size in memory

§p_flags: u32

Segment flags

§p_align: u32

Segment alignment

Implementations§

source§

impl ProgramHeader

source

pub fn parse( bytes: &[u8], offset: usize, count: usize, ctx: Endian ) -> Result<Vec<ProgramHeader>>

source

pub fn from_bytes(bytes: &[u8], phnum: usize) -> Vec<ProgramHeader>

source

pub unsafe fn from_raw_parts<'a>( phdrp: *const ProgramHeader, phnum: usize ) -> &'a [ProgramHeader]

§Safety

This function creates a ProgramHeader directly from a raw pointer

source

pub fn from_fd( fd: &mut File, offset: u64, count: usize ) -> Result<Vec<ProgramHeader>>

Trait Implementations§

source§

impl Clone for ProgramHeader

source§

fn clone(&self) -> ProgramHeader

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ProgramHeader

source§

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

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

impl Default for ProgramHeader

source§

fn default() -> ProgramHeader

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

impl From<ProgramHeader> for ProgramHeader

source§

fn from(ph: ElfProgramHeader) -> Self

Converts to this type from the input type.
source§

impl From<ProgramHeader> for ElfProgramHeader

source§

fn from(ph: ProgramHeader) -> Self

Converts to this type from the input type.
source§

impl PartialEq for ProgramHeader

source§

fn eq(&self, other: &ProgramHeader) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Plain for ProgramHeader

source§

fn from_bytes(bytes: &[u8]) -> Result<&Self, Error>
where Self: Sized,

source§

fn slice_from_bytes(bytes: &[u8]) -> Result<&[Self], Error>
where Self: Sized,

source§

fn slice_from_bytes_len(bytes: &[u8], len: usize) -> Result<&[Self], Error>
where Self: Sized,

source§

fn from_mut_bytes(bytes: &mut [u8]) -> Result<&mut Self, Error>
where Self: Sized,

source§

fn slice_from_mut_bytes(bytes: &mut [u8]) -> Result<&mut [Self], Error>
where Self: Sized,

source§

fn slice_from_mut_bytes_len( bytes: &mut [u8], len: usize ) -> Result<&mut [Self], Error>
where Self: Sized,

source§

fn copy_from_bytes(&mut self, bytes: &[u8]) -> Result<(), Error>

source§

impl SizeWith<Endian> for ProgramHeader

source§

impl<'a> TryFromCtx<'a, Endian> for ProgramHeader
where ProgramHeader: 'a,

§

type Error = Error

source§

fn try_from_ctx( src: &'a [u8], ctx: Endian ) -> Result<(Self, usize), Self::Error>

source§

impl<'a> TryIntoCtx<Endian> for &'a ProgramHeader

§

type Error = Error

source§

fn try_into_ctx(self, dst: &mut [u8], ctx: Endian) -> Result<usize, Self::Error>

source§

impl TryIntoCtx<Endian> for ProgramHeader

§

type Error = Error

source§

fn try_into_ctx(self, dst: &mut [u8], ctx: Endian) -> Result<usize, Self::Error>

source§

impl Copy for ProgramHeader

source§

impl StructuralPartialEq for ProgramHeader

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.