pub struct Version {
pub major: u8,
pub minor: u8,
pub patch: u16,
}
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 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 for Version
impl PartialOrd for Version
impl Copy for Version
impl Eq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
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
)