#[non_exhaustive]#[repr(u32)]pub enum Arch {
Show 29 variants
Unknown = 0,
X86 = 101,
X86Unknown = 199,
Amd64 = 201,
Amd64h = 202,
Amd64Unknown = 299,
Arm = 301,
ArmV5 = 302,
ArmV6 = 303,
ArmV6m = 304,
ArmV7 = 305,
ArmV7f = 306,
ArmV7s = 307,
ArmV7k = 308,
ArmV7m = 309,
ArmV7em = 310,
ArmUnknown = 399,
Arm64 = 401,
Arm64V8 = 402,
Arm64e = 403,
Arm64Unknown = 499,
Ppc = 501,
Ppc64 = 601,
Mips = 701,
Mips64 = 801,
Arm64_32 = 901,
Arm64_32V8 = 902,
Arm64_32Unknown = 999,
Wasm32 = 1_001,
}
Expand description
An enumeration of CPU architectures and variants.
The architectues are grouped into families, which can be retrieved by cpu_family
. There are
*Unknown
variants for each architecture to maintain forward-compatibility. This allows to
support architectures where the family is known but the subtype is not.
Each architecture has a canonical name, returned by Arch::name
. Likewise, architectures can
be parsed from their string names. In addition to that, in some cases aliases are supported. For
instance, "x86"
is aliased as "i386"
.
This enumeration is represented as u32
for C-bindings and lowlevel APIs. The values are
grouped by CPU family for forward compatibility.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unknown = 0
X86 = 101
X86Unknown = 199
Amd64 = 201
Amd64h = 202
Amd64Unknown = 299
Arm = 301
ArmV5 = 302
ArmV6 = 303
ArmV6m = 304
ArmV7 = 305
ArmV7f = 306
ArmV7s = 307
ArmV7k = 308
ArmV7m = 309
ArmV7em = 310
ArmUnknown = 399
Arm64 = 401
Arm64V8 = 402
Arm64e = 403
Arm64Unknown = 499
Ppc = 501
Ppc64 = 601
Mips = 701
Mips64 = 801
Arm64_32 = 901
Arm64_32V8 = 902
Arm64_32Unknown = 999
Wasm32 = 1_001
Implementations§
Source§impl Arch
impl Arch
Sourcepub fn from_u32(val: u32) -> Arch
pub fn from_u32(val: u32) -> Arch
Creates an Arch
from its u32
representation.
Returns Arch::Unknown
for all unknown values.
§Examples
use symbolic_common::Arch;
// Will print "X86"
println!("{:?}", Arch::from_u32(101));
Sourcepub fn cpu_family(self) -> CpuFamily
pub fn cpu_family(self) -> CpuFamily
Returns the CPU family of the CPU architecture.
§Examples
use symbolic_common::Arch;
// Will print "Intel32"
println!("{:?}", Arch::X86.cpu_family());
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
Returns the canonical name of the CPU architecture.
This follows the Apple conventions for naming architectures. For instance, Intel 32-bit
architectures are canonically named "x86"
, even though "i386"
would also be a valid
name.
For architectures with variants or subtypes, that subtype is encoded into the name. For instance the ARM v7-M architecture is named with a full `“armv7m”.
§Examples
use symbolic_common::Arch;
// Will print "x86"
println!("{}", Arch::X86.name());
Sourcepub fn well_known(self) -> bool
pub fn well_known(self) -> bool
Returns whether this architecture is well-known.
This is trivially true
for all architectures other than the *Unknown
variants.
§Examples
use symbolic_common::Arch;
assert!(Arch::X86.well_known());
assert!(!Arch::X86Unknown.well_known());