Skip to main content

Module os

Module os 

Source
Expand description

Operating-system detection and metadata.

OsInfo captures the host platform’s family, kind, distro (Linux only), version, architecture, byte order, and memory page size. It is probed once on first access and cached for the lifetime of the process.

let os = fsys::os::info();
assert!(!os.version.is_empty());

// Compile-time predicates short-circuit to the active target_os.
if fsys::os::is_linux() {
    assert_eq!(fsys::os::name(), "linux");
}

Structs§

OsInfo
Snapshot of operating-system metadata.

Enums§

Arch
CPU architecture the crate was compiled for.
Endianness
Byte endianness of the active target.
OsFamily
High-level family the active OS belongs to.
OsKind
Specific operating system the binary is running on.

Functions§

info
Returns a reference to the cached OsInfo, probing on first call.
is_linux
Returns true when the active build target is Linux.
is_macos
Returns true when the active build target is macOS.
is_windows
Returns true when the active build target is Windows.
name
Returns the canonical short name of the running OS.