[][src]Struct goblin::mach::segment::Segment

pub struct Segment<'a> {
    pub cmd: u32,
    pub cmdsize: u32,
    pub segname: [u8; 16],
    pub vmaddr: u64,
    pub vmsize: u64,
    pub fileoff: u64,
    pub filesize: u64,
    pub maxprot: u32,
    pub initprot: u32,
    pub nsects: u32,
    pub flags: u32,
    pub data: &'a [u8],
    // some fields omitted
}

Generalized 32/64 bit Segment Command

Fields

cmd: u32cmdsize: u32segname: [u8; 16]vmaddr: u64vmsize: u64fileoff: u64filesize: u64maxprot: u32initprot: u32nsects: u32flags: u32data: &'a [u8]

Methods

impl<'a> Segment<'a>[src]

pub fn new(ctx: Ctx, sections: &'a [u8]) -> Self[src]

Create a new, blank segment, with cmd either LC_SEGMENT_64, or LC_SEGMENT, depending on ctx. NB You are responsible for providing a correctly marshalled byte array as the sections. You should not use this for anything other than writing.

pub fn name(&self) -> Result<&str>[src]

Get the name of this segment

pub fn sections(&self) -> Result<Vec<(Section, SectionData<'a>)>>[src]

Get the sections from this segment, erroring if any section couldn't be retrieved

pub fn from_32(
    bytes: &'a [u8],
    segment: &SegmentCommand32,
    offset: usize,
    ctx: Ctx
) -> Result<Self, Error>
[src]

Convert the raw C 32-bit segment command to a generalized version

pub fn from_64(
    bytes: &'a [u8],
    segment: &SegmentCommand64,
    offset: usize,
    ctx: Ctx
) -> Result<Self, Error>
[src]

Convert the raw C 64-bit segment command to a generalized version

Trait Implementations

impl<'a, 'b> IntoIterator for &'b Segment<'a>[src]

type Item = Result<(Section, SectionData<'a>)>

The type of the elements being iterated over.

type IntoIter = SectionIterator<'a>

Which kind of iterator are we turning this into?

impl<'a> From<Segment<'a>> for SegmentCommand64[src]

impl<'a> From<Segment<'a>> for SegmentCommand32[src]

impl<'a> Debug for Segment<'a>[src]

impl<'a> IntoCtx<Ctx, [u8]> for Segment<'a>[src]

impl<'a> TryIntoCtx<Ctx, [u8]> for Segment<'a>[src]

type Error = Error

type Size = usize

impl<'a> SizeWith<Ctx> for Segment<'a>[src]

type Units = usize

Auto Trait Implementations

impl<'a> Send for Segment<'a>

impl<'a> Unpin for Segment<'a>

impl<'a> Sync for Segment<'a>

impl<'a> UnwindSafe for Segment<'a>

impl<'a> RefUnwindSafe for Segment<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]