Expand description
Operating system version.
Variants
Unknown
Unknown version.
Semantic(u64, u64, u64)
Semantic version (major.minor.patch).
Rolling(Option<String>)
Rolling version. Optionally contains the release date in the string format.
Custom(String)
Custom version format.
Implementations
sourceimpl Version
impl Version
sourcepub fn from_string<S: Into<String> + AsRef<str>>(s: S) -> Self
pub fn from_string<S: Into<String> + AsRef<str>>(s: S) -> Self
Constructs VersionType
from the given string.
Returns VersionType::Unknown
if the string is empty. If it can be parsed as a semantic
version, then VersionType::Semantic
, otherwise VersionType::Custom
.
Examples
use os_info::Version;
let v = Version::from_string("custom");
assert_eq!(Version::Custom("custom".to_owned()), v);
let v = Version::from_string("1.2.3");
assert_eq!(Version::Semantic(1, 2, 3), v);
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for Version
impl Ord for Version
sourceimpl PartialOrd<Version> for Version
impl PartialOrd<Version> for Version
sourcefn partial_cmp(&self, other: &Version) -> Option<Ordering>
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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
impl Eq for Version
impl StructuralEq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
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