File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5
5
6
6
## Unreleased
7
7
8
+ ### Added
9
+
10
+ - New method ` Toolchain::is_needed_by_rustwide ` for checking if a toolchain
11
+ is needed by rustwide itself (for installing tools).
12
+
8
13
## [ 0.13.1] - 2021-05-21
9
14
10
15
### Changed
Original file line number Diff line number Diff line change @@ -178,6 +178,25 @@ impl Toolchain {
178
178
} ) ,
179
179
} ;
180
180
181
+ /// Returns whether or not this toolchain is needed by rustwide itself.
182
+ ///
183
+ /// This toolchain is used for doing things like installing tools.
184
+ ///
185
+ /// ```rust
186
+ /// # use rustwide::Toolchain;
187
+ /// let tc = Toolchain::dist("stable-x86_64-unknown-linux-gnu");
188
+ /// assert!(tc.is_needed_by_rustwide());
189
+ /// let tc = Toolchain::dist("nightly-x86_64-unknown-linux-gnu");
190
+ /// assert!(!tc.is_needed_by_rustwide());
191
+ /// ```
192
+ pub fn is_needed_by_rustwide ( & self ) -> bool {
193
+ match & self . inner {
194
+ ToolchainInner :: Dist ( dist) => dist. name . starts_with ( MAIN_TOOLCHAIN_NAME ) ,
195
+ #[ cfg( feature = "unstable-toolchain-ci" ) ]
196
+ _ => false ,
197
+ }
198
+ }
199
+
181
200
/// Create a new dist toolchain.
182
201
///
183
202
/// Dist toolchains are all the toolchains available through rustup and distributed from
You can’t perform that action at this time.
0 commit comments