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());
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Channel
impl UnwindSafe for Channel
Blanket Implementations
Mutably borrows from an owned value. Read more