Struct MachObject

Source
pub struct MachObject<'a> {
    pub header: Header,
    pub uuid: Option<Uuid>,
    pub segments: Vec<SegmentCommand>,
    pub commands: Vec<LoadCommand<'a>>,
}

Fields§

§header: Header§uuid: Option<Uuid>§segments: Vec<SegmentCommand>§commands: Vec<LoadCommand<'a>>

Implementations§

Source§

impl<'a> MachObject<'a>

Source

pub fn parse(bytes: &'a [u8]) -> Result<MachObject<'_>, ()>

Examples found in repository?
examples/reader.rs (line 20)
9fn main() {
10    let args: Vec<_> = env::args().collect();
11    if args.len() != 2 {
12        println!("Usage: {} <file>", args[0]);
13        return;
14    }
15
16    let mut fh = fs::File::open(&args[1]).unwrap();
17    let mut buf: Vec<u8> = Vec::new();
18    let _ = fh.read_to_end(&mut buf);
19
20    match macho::MachObject::parse(&buf[..]) {
21        Ok(header) => {
22            println!("{:#?}", header);
23        },
24        Err(_) => {
25            panic!("Error parsing header")
26        }
27
28    }
29}

Trait Implementations§

Source§

impl<'a> Debug for MachObject<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MachObject<'a>

§

impl<'a> RefUnwindSafe for MachObject<'a>

§

impl<'a> Send for MachObject<'a>

§

impl<'a> Sync for MachObject<'a>

§

impl<'a> Unpin for MachObject<'a>

§

impl<'a> UnwindSafe for MachObject<'a>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.