[][src]Function metagoblin::mach::constants::cputype::get_arch_name_from_types

pub fn get_arch_name_from_types(
    cputype: u32,
    cpusubtype: u32
) -> Option<&'static str>

Get the architecture name from cputype and cpusubtype

When using this method to determine the architecture name of an instance of goblin::mach::header::Header, use the provided method cputype() and cpusubtype() instead of corresponding field cputype and cpusubtype.

For example:

use std::fs::read;
use goblin::mach::constants::cputype::get_arch_name_from_types;
use goblin::mach::Mach;

read("path/to/macho").and_then(|buf| {
    if let Ok(Mach::Binary(a)) = Mach::parse(&buf) {
        println!("arch name: {}", get_arch_name_from_types(a.header.cputype(), a.header.cpusubtype()).unwrap());
    }
    Ok(())
});