From b6f7da61d879c67111e179a261149678d73e266f Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 4 Sep 2021 10:47:54 -0600 Subject: Document more things Also, test rustdoc in CI, and demote missing_docs from a deny to a warning (but still deny it in CI). --- src/sys/utsname.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/sys/utsname.rs') diff --git a/src/sys/utsname.rs b/src/sys/utsname.rs index bf1a814d..98edee04 100644 --- a/src/sys/utsname.rs +++ b/src/sys/utsname.rs @@ -1,34 +1,42 @@ +//! Get system identification use std::mem; use libc::{self, c_char}; use std::ffi::CStr; use std::str::from_utf8_unchecked; +/// Describes the running system. Return type of [`uname`]. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[repr(transparent)] pub struct UtsName(libc::utsname); impl UtsName { + /// Name of the operating system implementation pub fn sysname(&self) -> &str { to_str(&(&self.0.sysname as *const c_char ) as *const *const c_char) } + /// Network name of this machine. pub fn nodename(&self) -> &str { to_str(&(&self.0.nodename as *const c_char ) as *const *const c_char) } + /// Release level of the operating system. pub fn release(&self) -> &str { to_str(&(&self.0.release as *const c_char ) as *const *const c_char) } + /// Version level of the operating system. pub fn version(&self) -> &str { to_str(&(&self.0.version as *const c_char ) as *const *const c_char) } + /// Machine hardware platform. pub fn machine(&self) -> &str { to_str(&(&self.0.machine as *const c_char ) as *const *const c_char) } } +/// Get system identification pub fn uname() -> UtsName { unsafe { let mut ret = mem::MaybeUninit::uninit(); -- cgit v1.2.3