[−][src]Struct version_check::Channel
Release channel: "dev", "nightly", "beta", or "stable".
Implementations
impl Channel
[src]
pub fn read() -> Option<Channel>
[src]
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.") };
pub fn parse(version: &str) -> Option<Channel>
[src]
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());
pub fn supports_features(&self) -> bool
[src]
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());
pub fn is_dev(&self) -> bool
[src]
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());
pub fn is_nightly(&self) -> bool
[src]
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());
pub fn is_beta(&self) -> bool
[src]
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());
pub fn is_stable(&self) -> bool
[src]
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
impl Clone for Channel
[src]
impl Copy for Channel
[src]
impl Debug for Channel
[src]
impl Display for Channel
[src]
impl Eq for Channel
[src]
impl PartialEq<Channel> for Channel
[src]
impl StructuralEq for Channel
[src]
impl StructuralPartialEq for Channel
[src]
Auto Trait Implementations
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnwindSafe for Channel
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,