pub enum Version {
Unknown,
Semantic(u64, u64, u64),
Rolling(Option<String>),
Custom(String),
}
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§
source§impl 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§
source§impl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
source§fn 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
source§impl Ord for Version
impl Ord for Version
source§impl PartialEq for Version
impl PartialEq for Version
source§impl PartialOrd for Version
impl PartialOrd 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 moreimpl 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