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>
impl<'a> MachObject<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<MachObject<'_>, ()>
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more