Struct version_check::Channel[][src]

pub struct Channel(_);
Expand description

Release channel: “dev”, “nightly”, “beta”, or “stable”.

Implementations

Reads the release channel of the running compiler. If it cannot be determined (see the top-level documentation), returns None.

Example
use version_check::Channel;

match Channel::read() {
    Some(c) => format!("The channel is: {}", c),
    None => format!("Failed to read the release channel.")
};

Parse a Rust release channel from a Rust release version string (of the form major[.minor[.patch[-channel]]]). Returns None if version is not a valid Rust version string.

Example
use version_check::Channel;

let dev = Channel::parse("1.3.0-dev").unwrap();
assert!(dev.is_dev());

let nightly = Channel::parse("1.42.2-nightly").unwrap();
assert!(nightly.is_nightly());

let beta = Channel::parse("1.32.0-beta").unwrap();
assert!(beta.is_beta());

let stable = Channel::parse("1.4.0").unwrap();
assert!(stable.is_stable());

Returns true if this channel supports feature flags. In other words, returns true if the channel is either dev or nightly.

Example
use version_check::Channel;

let dev = Channel::parse("1.3.0-dev").unwrap();
assert!(dev.supports_features());

let nightly = Channel::parse("1.42.2-nightly").unwrap();
assert!(nightly.supports_features());

let beta = Channel::parse("1.32.0-beta").unwrap();
assert!(!beta.supports_features());

let stable = Channel::parse("1.4.0").unwrap();
assert!(!stable.supports_features());

Returns true if this channel is dev and false otherwise.

Example
use version_check::Channel;

let dev = Channel::parse("1.3.0-dev").unwrap();
assert!(dev.is_dev());

let stable = Channel::parse("1.0.0").unwrap();
assert!(!stable.is_dev());

Returns true if this channel is nightly and false otherwise.

Example
use version_check::Channel;

let nightly = Channel::parse("1.3.0-nightly").unwrap();
assert!(nightly.is_nightly());

let stable = Channel::parse("1.0.0").unwrap();
assert!(!stable.is_nightly());

Returns true if this channel is beta and false otherwise.

Example
use version_check::Channel;

let beta = Channel::parse("1.3.0-beta").unwrap();
assert!(beta.is_beta());

let stable = Channel::parse("1.0.0").unwrap();
assert!(!stable.is_beta());

Returns true if this channel is stable and false otherwise.

Example
use version_check::Channel;

let stable = Channel::parse("1.0.0").unwrap();
assert!(stable.is_stable());

let beta = Channel::parse("1.3.0-beta").unwrap();
assert!(!beta.is_stable());

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.