#detect #linux #freebsd #executable #os #x86-64 #64-bit

bin+lib bitness

Rust library for detecting OS bitness independently of the executable's bitness. Windows, GNU/Linux and FreeBSD currently supported.

7 unstable releases

0.4.0 Nov 20, 2020
0.3.3 Jan 17, 2018
0.2.0 Jan 13, 2018
0.1.0 Jan 11, 2018

#1604 in Unix APIs

Download history 3620/week @ 2026-01-03 4358/week @ 2026-01-10 6865/week @ 2026-01-17 4570/week @ 2026-01-24 4987/week @ 2026-01-31 4721/week @ 2026-02-07 4606/week @ 2026-02-14 4814/week @ 2026-02-21 6288/week @ 2026-02-28 9082/week @ 2026-03-07 6580/week @ 2026-03-14 7407/week @ 2026-03-21 6373/week @ 2026-03-28 6045/week @ 2026-04-04 6732/week @ 2026-04-11 6734/week @ 2026-04-18

26,755 downloads per month
Used in 5 crates (3 directly)

MIT/Apache

10KB
87 lines

Bitness Build Status Build status Crates.io

Rust library for detecting OS bitness independently of the executable's bitness. Windows, GNU/Linux and FreeBSD currently supported.

How to use

let bitness = bitness::os_bitness().unwrap();

match bitness {
  Bitness::X86_32 => println!("We're 32-bit!"),
  Bitness::X86_64 => println!("We're 64-bit!"),
  _ => { }
}

Dependencies

~0.1–2.3MB
~42K SLoC