summaryrefslogtreecommitdiff
path: root/src/sys/utsname.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-09-04 18:25:41 +0000
committerGitHub <noreply@github.com>2021-09-04 18:25:41 +0000
commit5465167a7b56d8caeb4a44002eb108fadbfd49cb (patch)
tree3693b52af91034b1762205926ba8b00f06d4b685 /src/sys/utsname.rs
parent39c63662ed910763b0ccc02473121f12517d1f42 (diff)
parenta757be75fcdda80d9c441db35fdfedb402714223 (diff)
downloadnix-5465167a7b56d8caeb4a44002eb108fadbfd49cb.zip
Merge #1511
1511: Document more things r=asomers a=asomers Also, test rustdoc in CI, and demote missing_docs from a deny to a warning (but still deny it in CI). Co-authored-by: Alan Somers <asomers@gmail.com>
Diffstat (limited to 'src/sys/utsname.rs')
-rw-r--r--src/sys/utsname.rs8
1 files changed, 8 insertions, 0 deletions
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();