[−][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
pub fn stat_block_device(&self, name: &str) -> Result<StorageDevice>
[src]
Parses a StorageDevice object from system. If the provided name
doesn't start with sd
returns an error.
pub fn stat_scsi_cdrom(&self, name: &str) -> Result<ScsiCdrom>
[src]
Parses a DeviceMapper object from system. If the provided name
doesn't start with dm
returns an error.
pub fn stat_device_mapper(&self, name: &str) -> Result<DeviceMapper>
[src]
Parses a ScsiCdrom object from system. If the provided name
doesn't start with sr
returns an error.
pub fn stat_multiple_device_storage(
&self,
name: &str
) -> Result<MultipleDeviceStorage>
[src]
&self,
name: &str
) -> Result<MultipleDeviceStorage>
Parses a MultipleDeviceStorage object from system. If the provided name
doesn't start with md
returns an error.
pub fn block_size(&self, name: &str) -> Result<i64>
[src]
Returns block size of device in bytes
pub fn memory(&self) -> Result<Memory>
[src]
Returns detailed information about memory
pub fn stat_process(&self, pid: i32) -> Result<Process>
[src]
Returns detailed Process information parsed from /proc/[pid]/stat
pub fn pids(&self) -> Result<Vec<i32>>
[src]
Returns a list of pids read from /proc
pub fn processes(&self) -> Result<Processes>
[src]
Returns all processes currently seen in /proc parsed as Processes
pub fn kernel_version(&self) -> Result<String>
[src]
Returns kernel version of host os.
pub fn mounts(&self) -> Result<MountPoints>
[src]
Returns MountPoints read from /proc/mounts
pub fn cores(&self) -> Result<Cores>
[src]
Returns virtual Cores of host cpu
pub fn processor(&self) -> Result<Processor>
[src]
Returns a Processor object containing gathered information about host cpu
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>,