Skip to main content

Module arch

Module arch 

Source
Available on crate feature sys only.
Expand description

CPU architecture type for system information.

This module provides a type-safe abstraction for CPU architectures, ensuring valid architecture identifiers and providing convenient constants for common architectures.

§Supported Architectures

This type supports all major CPU architectures:

  • x86: 32-bit x86 (i386, i686)
  • x86_64: 64-bit x86 (amd64)
  • aarch64: 64-bit ARM (arm64)
  • arm: 32-bit ARM
  • riscv32: 32-bit RISC-V
  • riscv64: 64-bit RISC-V
  • wasm32: 32-bit WebAssembly
  • wasm64: 64-bit WebAssembly
  • mips: 32-bit MIPS
  • mips64: 64-bit MIPS
  • powerpc: 32-bit PowerPC
  • powerpc64: 64-bit PowerPC
  • s390x: IBM System/390

§Examples

use bare_types::sys::Arch;

// Get current architecture (compile-time constant)
let arch = Arch::current();

// Check architecture properties
assert!(arch.is_64_bit() || arch.is_32_bit());

// Parse from string
let arch: Arch = "x86_64".parse()?;
assert_eq!(arch, Arch::X86_64);

Enums§

Arch
CPU architecture type.
ArchError
Error type for architecture parsing.