Skip to content

Commit b53f6f1

Browse files
committed
change bitness to a nuber
1 parent e9fce26 commit b53f6f1

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

lib/osinfo_lib/src/lib.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,14 @@ pub struct OsInfo {
1818
/// Defines the codename for the operating system as returned from `lsb_release --codename`.
1919
#[serde(skip_serializing_if = "Option::is_none")]
2020
codename: Option<String>,
21-
bitness: Bitness,
21+
bitness: Option<i32>,
2222
/// Defines the processor architecture as reported by `uname -m` on the operating system.
2323
#[serde(skip_serializing_if = "Option::is_none")]
2424
architecture: Option<String>,
2525
#[serde(rename = "_name", skip_serializing_if = "Option::is_none")]
2626
name: Option<String>,
2727
}
2828

29-
/// Defines whether the operating system is a 32-bit or 64-bit operating system.
30-
#[derive(Debug, Clone, PartialEq, Serialize)]
31-
pub enum Bitness {
32-
#[serde(rename = "32")]
33-
Bit32,
34-
#[serde(rename = "64")]
35-
Bit64,
36-
#[serde(rename = "unknown")]
37-
Unknown,
38-
}
39-
4029
/// Defines whether the operating system is Linux, macOS, or Windows.
4130
#[derive(Debug, Clone, PartialEq, Serialize)]
4231
pub enum Family {
@@ -67,10 +56,10 @@ impl OsInfo {
6756
os_info::Type::Windows => Family::Windows,
6857
_ => Family::Linux,
6958
};
70-
let bits: Bitness = match os_info.bitness() {
71-
os_info::Bitness::X32 => Bitness::Bit32,
72-
os_info::Bitness::X64 => Bitness::Bit64,
73-
_ => Bitness::Unknown,
59+
let bits = match os_info.bitness() {
60+
os_info::Bitness::X32 => Some(32),
61+
os_info::Bitness::X64 => Some(64),
62+
_ => None,
7463
};
7564
let version = os_info.version().to_string();
7665
let name = if include_name {

0 commit comments

Comments
 (0)