Struct procfs::CpuInfo

source ·
pub struct CpuInfo {
    pub fields: HashMap<String, String>,
    pub cpus: Vec<HashMap<String, String>>,
}
Expand description

Represents the data from /proc/cpuinfo.

The fields field stores the fields that are common among all CPUs. The cpus field stores CPU-specific info.

For common fields, there are methods that will return the data, converted to a more appropriate data type. These methods will all return None if the field doesn’t exist, or is in some unexpected format (in that case, you’ll have to access the string data directly).

Fields§

§fields: HashMap<String, String>

This stores fields that are common among all CPUs

§cpus: Vec<HashMap<String, String>>

Implementations§

Get CpuInfo from a custom Read instead of the default /proc/cpuinfo.

Get the total number of cpu cores.

This is the number of entries in the /proc/cpuinfo file.

Get info for a specific cpu.

This will merge the common fields with the cpu-specific fields.

Returns None if the requested cpu index is not found.

Get the content of a specific field associated to a CPU

Returns None if the requested cpu index is not found.

May not be available on some older 2.6 kernels

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.