rust_toolchain/channel/
stable.rs

1use crate::RustVersion;
2
3/// The `Stable` release [`channel`]
4///
5/// [`channel`]: https://rust-lang.github.io/rustup/concepts/channels.html
6#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
7pub struct Stable {
8    /// The three component Rust version
9    pub version: RustVersion,
10}
11
12#[cfg(test)]
13mod tests {
14    use crate::{channel::Stable, RustVersion};
15
16    #[yare::parameterized(
17        patch1 = { RustVersion::new(0, 0, 0), RustVersion::new(0, 0, 1) },
18        minor1 = { RustVersion::new(0, 0, 0), RustVersion::new(0, 1, 0) },
19        major1 = { RustVersion::new(0, 0, 0), RustVersion::new(1, 0, 0) },
20        minor_over_patch = { RustVersion::new(0, 0, 999), RustVersion::new(0, 1, 0) },
21        major_over_patch = { RustVersion::new(0, 0, 999), RustVersion::new(1, 0, 0) },
22        major_over_minor = { RustVersion::new(0, 999, 0), RustVersion::new(1, 0, 0) },
23    )]
24    fn ord(left: RustVersion, right: RustVersion) {
25        let left = Stable { version: left };
26        let right = Stable { version: right };
27
28        assert!(left < right);
29    }
30}