Struct os_info::Version[][src]

pub struct Version { /* fields omitted */ }

Operating system version including version number and optional edition.

Methods

impl Version
[src]

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());

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());

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());

Returns operating system version. See VersionType for details.

Examples

use os_info::{Version, VersionType};

let version = Version::unknown();
assert_eq!(VersionType::Unknown, *version.version());

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]

Formats the value using the given formatter. Read more

impl Clone for Version
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Version
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Version
[src]

impl PartialOrd for Version
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

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]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Hash for Version
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Display for Version
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Version

impl Sync for Version