[−][src]Struct rsys::Rsys
Main interface that allows for os-agnostic api.
Implementations
impl Rsys
[src]
pub fn new() -> Self
[src]
Creates a new instance of Rsys
pub fn hostname(&self) -> Result<String>
[src]
Returns a hostname.
- linux
- by reading
/proc/sys/kernel/hostname
- by reading
- macos
- by calling
sysctl("kern.hostname")
- by calling
- windows
- by calling win32 api
GetComputerNameA
- by calling win32 api
pub fn uptime(&self) -> Result<u64>
[src]
Returns time since boot in seconds.
- linux
- by reading
/proc/uptime
- by reading
- macos
- by calling
sysctl("kern.boottime")
- by calling
- windows
- by calling win32 api
GetTickCount64
- by calling win32 api
pub fn os(&self) -> String
[src]
Returns operating system. Reexported env::consts::OS
for convenience.
pub fn arch(&self) -> Result<String>
[src]
Returns cpu architecture.
- linux and macos
- by calling
uname -m
- by calling
- windows
- by calling win32 api
GetSystemInfo
- by calling win32 api
pub fn cpu(&self) -> Result<String>
[src]
Returns a cpu model name.
- linux
- by reading
/proc/cpuinfo
- by reading
- macos
- by calling
sysctl("machdep.cpu.brand_string")
...
- by calling
pub fn cpu_clock(&self) -> Result<f32>
[src]
Returns clock speed of cpu.
- linux
- by reading
/proc/cpuinfo
- by reading
- macos
- by calling
sysctl("hw.cpufrequency")
...
- by calling
pub fn cpu_cores(&self) -> Result<u16>
[src]
Returns cpu cores.
- linux
- by reading
/proc/cpuinfo
- by reading
- macos
- by calling
sysctl("hw.physicalcpu")
- by calling
- windows
- by determining if cpu is hyperthreaded and calculating from logical cores.
pub fn logical_cores(&self) -> Result<u16>
[src]
Returns logical cpu cores.
- linux
- by reading
/proc/cpuinfo
- by reading
- macos
- by calling
sysctl("hw.logicalcpu")
- by calling
- windows
- by calling win32 api
GetSystemInfo
- by calling win32 api
pub fn memory_total(&self) -> Result<usize>
[src]
Returns total ram memory.
- linux
- by reading
/proc/meminfo
- by reading
- macos
- by calling
sysctl("hw.memsize")
- by calling
- windows
- by calling win32 api
GlobalMemoryStatusEx
- by calling win32 api
pub fn memory_free(&self) -> Result<usize>
[src]
Returns free ram memory.
- linux
- by reading
/proc/meminfo
...
- by reading
pub fn swap_total(&self) -> Result<usize>
[src]
Returns total swap size.
- linux
- by reading
/proc/meminfo
- by reading
- macos
- by calling
sysctl("hw.swapusage")
- by calling
- windows
- by calling win32 api
GlobalMemoryStatusEx
- by calling win32 api
pub fn swap_free(&self) -> Result<usize>
[src]
Returns free swap size.
- linux
- by reading
/proc/meminfo
- by reading
- macos
- by calling
sysctl("hw.swapusage")
- by calling
- windows
- by calling win32 api
GlobalMemoryStatusEx
- by calling win32 api
pub fn default_iface(&self) -> Result<String>
[src]
Returns a default internet interface.
- linux
- by calling
route
and determining default route
- by calling
- macos
- by calling
route get default
...
- by calling
pub fn ipv4(&self, iface: &str) -> Result<String>
[src]
Returns IP address version 4 of interface iface.
- linux
- by calling
ip address show <iface>
- by calling
- macos
- by calling
ipconfig getifaddr <iface>
...
- by calling
pub fn ipv6(&self, iface: &str) -> Result<String>
[src]
Returns IP address version 6 of interface iface.
pub fn mac(&self, iface: &str) -> Result<String>
[src]
Returns a MAC address of interface iface.
- linux
- by calling
ip address show <iface>
...
- by calling
pub fn interfaces(&self) -> Result<Vec<String>>
[src]
Returns a vector of names of network interfaces that are available.
- linux
- by calling
ip address show
...
- by calling
pub fn domainname(&self) -> Result<String>
[src]
Returns a domain name.
- linux
- by reading
/proc/sys/kernel/domainname
- by reading
- windows
- by calling win32 api
NetWkstaGetInfo
...
- by calling win32 api
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Rsys
impl !Send for Rsys
impl !Sync for Rsys
impl Unpin for Rsys
impl !UnwindSafe for Rsys
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,