Skip to main content

Module os_type

Module os_type 

Source
Available on crate feature sys only.
Expand description

Operating system type for system information.

This module provides a type-safe abstraction for operating system types, ensuring valid OS identifiers and providing convenient constants for common operating systems.

§Supported Operating Systems

This type supports all major operating systems:

  • Linux: GNU/Linux distributions
  • MacOS: macOS (formerly OS X)
  • Windows: Microsoft Windows
  • FreeBSD: FreeBSD operating system
  • OpenBSD: OpenBSD operating system
  • NetBSD: NetBSD operating system
  • DragonFly: DragonFly BSD
  • Solaris: Oracle Solaris
  • Illumos: Illumos-based systems (OpenIndiana, etc.)
  • Android: Android mobile OS
  • iOS: Apple iOS
  • Redox: Redox OS (Rust-based)
  • Fuchsia: Google Fuchsia
  • Hermit: HermitCore unikernel
  • VxWorks: Wind River VxWorks
  • AIX: IBM AIX
  • Haiku: Haiku OS

§Examples

use bare_types::sys::OsType;

// Get current OS (compile-time constant)
let os = OsType::current();

// Check OS family
assert!(os.is_unix() || os.is_windows());

// Parse from string
let os: OsType = "linux".parse()?;
assert_eq!(os, OsType::LINUX);

Enums§

OsType
Operating system type.
OsTypeError
Error type for OS type parsing.