use std::fmt;
use heim_common::prelude::*;
use crate::{sys, Arch};
pub struct Platform(sys::Platform);
wrap!(Platform, sys::Platform);
impl Platform {
pub fn system(&self) -> &str {
self.as_ref().system()
}
pub fn release(&self) -> &str {
self.as_ref().release()
}
pub fn version(&self) -> &str {
self.as_ref().version()
}
pub fn hostname(&self) -> &str {
self.as_ref().hostname()
}
pub fn architecture(&self) -> Arch {
self.as_ref().architecture()
}
}
impl fmt::Debug for Platform {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Platform")
.field("system", &self.system())
.field("release", &self.release())
.field("version", &self.version())
.field("hostname", &self.hostname())
.field("architecture", &self.architecture())
.finish()
}
}
pub fn platform() -> impl Future<Output = Result<Platform>> {
sys::platform().map_ok(Into::into)
}