SysInfo

Struct SysInfo 

Source
#[repr(C)]
pub struct SysInfo {
Show 13 fields pub uptime: c_ulong, pub loads: [c_ulong; 3], pub totalram: c_ulong, pub freeram: c_ulong, pub sharedram: c_ulong, pub bufferram: c_ulong, pub totalswap: c_ulong, pub freeswap: c_ulong, pub procs: u16, pub totalhigh: c_ulong, pub freehigh: c_ulong, pub mem_unit: c_uint, pub _reserved: [u8; 256],
}
Expand description

系统信息结构体 对应 Linux 的 struct sysinfo

Fields§

§uptime: c_ulong

系统启动后经过的时间,单位为秒

§loads: [c_ulong; 3]

1 分钟、5 分钟和 15 分钟的平均负载

§totalram: c_ulong

总内存大小,单位为字节

§freeram: c_ulong

可用内存大小,单位为字节

§sharedram: c_ulong

缓存大小,单位为字节

§bufferram: c_ulong

用作文件缓存的内存大小,单位为字节

§totalswap: c_ulong

总交换空间大小,单位为字节

§freeswap: c_ulong

可用交换空间大小,单位为字节

§procs: u16

当前进程数

§totalhigh: c_ulong

高端内存总大小,单位为字节

§freehigh: c_ulong

高端可用内存大小,单位为字节

§mem_unit: c_uint

内存单位大小,单位为字节

§_reserved: [u8; 256]

保留字段,供未来使用

Implementations§

Source§

impl SysInfo

Source

pub fn new() -> Self

创建一个新的 SysInfo 实例,所有字段初始化为零

Trait Implementations§

Source§

impl Clone for SysInfo

Source§

fn clone(&self) -> SysInfo

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SysInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for SysInfo

Auto Trait Implementations§

§

impl Freeze for SysInfo

§

impl RefUnwindSafe for SysInfo

§

impl Send for SysInfo

§

impl Sync for SysInfo

§

impl Unpin for SysInfo

§

impl UnwindSafe for SysInfo

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.