pub struct BuildInfo {
pub version: String,
pub flags: HashSet<String>,
pub extra: String,
}
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§
source§impl BuildInfo
impl BuildInfo
pub fn new(version: &str, flags: HashSet<String>, extra: String) -> BuildInfo
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 StructuralPartialEq for BuildInfo
Auto Trait Implementations§
impl Freeze for BuildInfo
impl RefUnwindSafe for BuildInfo
impl Send for BuildInfo
impl Sync for BuildInfo
impl Unpin for BuildInfo
impl UnwindSafe for BuildInfo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)