Expand description
Represents a kernel version, in major.minor.release version.
Fields§
§major: u8
§minor: u8
§patch: u16
Implementations§
source§impl Version
impl Version
pub fn new(major: u8, minor: u8, patch: u16) -> Version
sourcepub fn current() -> ProcResult<Self>
pub fn current() -> ProcResult<Self>
Returns the kernel version of the currently running kernel.
This is taken from /proc/sys/kernel/osrelease
;
sourcepub fn from_str(s: &str) -> Result<Self, &'static str>
pub fn from_str(s: &str) -> Result<Self, &'static str>
Parses a kernel version string, in major.minor.release syntax.
Note that any extra information (stuff after a dash) is ignored.
Example
let a = KernelVersion::from_str("3.16.0-6-amd64").unwrap();
let b = KernelVersion::new(3, 16, 0);
assert_eq!(a, b);
Trait Implementations§
source§impl FromStr for Version
impl FromStr for Version
source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a kernel version string, in major.minor.release syntax.
Note that any extra information (stuff after a dash) is ignored.
Example
let a: KernelVersion = "3.16.0-6-amd64".parse().unwrap();
let b = KernelVersion::new(3, 16, 0);
assert_eq!(a, b);
source§impl Ord for Version
impl Ord for Version
source§impl PartialOrd<Version> for Version
impl PartialOrd<Version> for Version
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more