Expand description
Represents a kernel build information
Fields
version: String
flags: HashSet<String>
extra: String
This field contains any extra data from the /proc/sys/kernel/version file. It generally contains the build date of the kernel, but the format of the date can vary.
A method named extra_date
is provided which would try to parse some date formats. When the date format is not supported, an error will be returned. It depends on chrono feature.
Implementations
sourceimpl BuildInfo
impl BuildInfo
pub fn new(version: &str, flags: HashSet<String>, extra: String) -> BuildInfo
sourcepub fn current() -> ProcResult<Self>
pub fn current() -> ProcResult<Self>
Read the kernel build information from current running kernel
Generated by scripts/mkcompile_h
when building the kernel.
The file is located at /proc/sys/kernel/version
.
sourcepub fn version_number(&self) -> ProcResult<u32>
pub fn version_number(&self) -> ProcResult<u32>
Return version number
This would parse number from first digits of version string. For example, #21~1 to 21.
sourcepub fn extra_date(&self) -> ProcResult<DateTime<Local>>
pub fn extra_date(&self) -> ProcResult<DateTime<Local>>
Parse extra field to DateTime
object
This function may fail as TIMESTAMP can be various formats.
Trait Implementations
impl Eq for BuildInfo
impl StructuralEq for BuildInfo
impl StructuralPartialEq for BuildInfo
Auto Trait Implementations
impl RefUnwindSafe for BuildInfo
impl Send for BuildInfo
impl Sync for BuildInfo
impl Unpin for BuildInfo
impl UnwindSafe for BuildInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more