use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use super::unknown_value::UnknownValue;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
pub struct OsInfo {
pub architecture: String,
pub bitness: String,
pub os_type: String,
pub version: String,
}
impl UnknownValue for OsInfo {
fn unknown_value() -> Self {
os_info::Info::unknown().into()
}
}
impl From<os_info::Info> for OsInfo {
fn from(value: os_info::Info) -> Self {
let architecture = value.architecture().unwrap_or("unknown").to_string();
let bitness = value.bitness().to_string();
let os_type = value.os_type().to_string();
let version = value.version().to_string();
Self {
architecture,
bitness,
os_type,
version,
}
}
}