Struct os_info::Version [−][src]
pub struct Version { /* fields omitted */ }
Operating system version including version number and optional edition.
Methods
impl Version
[src]
impl Version
pub fn unknown() -> Self
[src]
pub fn unknown() -> Self
Constructs a new Version
instance with unknown version and None
edition.
Examples
use os_info::{Version, VersionType}; let version = Version::unknown(); assert_eq!(VersionType::Unknown, *version.version()); assert_eq!(None, version.edition());
pub fn semantic(
major: u64,
minor: u64,
patch: u64,
edition: Option<String>
) -> Self
[src]
pub fn semantic(
major: u64,
minor: u64,
patch: u64,
edition: Option<String>
) -> Self
Constructs a new Version
instance with semantic version and given edition.
Examples
use os_info::{Version, VersionType}; let version = Version::semantic(0, 1, 2, None); assert_eq!(VersionType::Semantic(0, 1, 2), *version.version()); assert_eq!(None, version.edition());
pub fn custom<T: Into<String>>(version: T, edition: Option<String>) -> Self
[src]
pub fn custom<T: Into<String>>(version: T, edition: Option<String>) -> Self
Construct a new Version
instance with "custom" (non semantic) version and given edition.
Examples
use os_info::{Version, VersionType}; let ver = "version".to_string(); let edition = "edition".to_string(); let version = Version::custom(ver.clone(), Some(edition.clone())); assert_eq!(VersionType::Custom(ver), *version.version()); assert_eq!(Some(edition.as_ref()), version.edition());
pub fn version(&self) -> &VersionType
[src]
pub fn version(&self) -> &VersionType
Returns operating system version. See VersionType
for details.
Examples
use os_info::{Version, VersionType}; let version = Version::unknown(); assert_eq!(VersionType::Unknown, *version.version());
pub fn edition(&self) -> Option<&str>
[src]
pub fn edition(&self) -> Option<&str>
Returns optional (can be absent) operation system edition.
Examples
use os_info::Version; let version = Version::unknown(); assert_eq!(None, version.edition());
Trait Implementations
impl Debug for Version
[src]
impl Debug for Version
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Version
[src]
impl Clone for Version
fn clone(&self) -> Version
[src]
fn clone(&self) -> Version
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Version
[src]
impl PartialEq for Version
fn eq(&self, other: &Version) -> bool
[src]
fn eq(&self, other: &Version) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Version) -> bool
[src]
fn ne(&self, other: &Version) -> bool
This method tests for !=
.
impl Eq for Version
[src]
impl Eq for Version
impl PartialOrd for Version
[src]
impl PartialOrd for Version
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Version) -> bool
[src]
fn lt(&self, other: &Version) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Version) -> bool
[src]
fn le(&self, other: &Version) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Version) -> bool
[src]
fn gt(&self, other: &Version) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Version) -> bool
[src]
fn ge(&self, other: &Version) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Version
[src]
impl Ord for Version
fn cmp(&self, other: &Version) -> Ordering
[src]
fn cmp(&self, other: &Version) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for Version
[src]
impl Hash for Version
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Version
[src]
impl Display for Version