pub struct SystemInfo {
pub os_type: String,
pub cpu_cores: usize,
pub total_memory_bytes: u64,
pub is_debug: bool,
pub is_wasm: bool,
pub target_arch: String,
}
Expand description
System information structure
Contains runtime-detected system hardware and environment information, used for allocator selection decisions.
§Fields
os_type
- Operating system type (linux, macos, windows, etc.)cpu_cores
- CPU core count (including hyperthreaded cores)total_memory_bytes
- Total memory in bytesis_debug
- Whether this is a Debug buildis_wasm
- Whether this is a WASM environmenttarget_arch
- Target architecture (x86_64, aarch64, etc.)
§Example
use auto_allocator;
let info = auto_allocator::get_allocator_info();
let sys = &info.system_info;
println!("Operating system: {}", sys.os_type);
println!("CPU cores: {}", sys.cpu_cores);
println!("Total memory: {}", auto_allocator::format_memory_size(sys.total_memory_bytes));
Fields§
§os_type: String
Operating system type
Examples: “linux”, “macos”, “windows”, “unknown”
cpu_cores: usize
CPU core count
Detected via std::thread::available_parallelism()
, includes hyperthreaded core count
total_memory_bytes: u64
Total memory in bytes
System total physical memory, used for hardware specification assessment.
Use format_memory_size()
to format as human-readable string.
is_debug: bool
Whether this is a Debug build
Debug builds automatically select system allocator for faster compilation
is_wasm: bool
Whether this is a WASM environment
WASM environments automatically select system allocator for compatibility
target_arch: String
Target architecture
Examples: “x86_64”, “aarch64”, “riscv32”, “wasm32”
Trait Implementations§
Source§impl Clone for SystemInfo
impl Clone for SystemInfo
Source§fn clone(&self) -> SystemInfo
fn clone(&self) -> SystemInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for SystemInfo
impl RefUnwindSafe for SystemInfo
impl Send for SystemInfo
impl Sync for SystemInfo
impl Unpin for SystemInfo
impl UnwindSafe for SystemInfo
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