@@ -23,7 +23,8 @@ use crate::{
23
23
RustupError ,
24
24
config:: { ActiveReason , Cfg , InstalledPath } ,
25
25
dist:: {
26
- PartialToolchainDesc , TargetTriple , component:: components:: Components ,
26
+ PartialToolchainDesc , TargetTriple ,
27
+ component:: components:: { Component , Components } ,
27
28
prefix:: InstallPrefix ,
28
29
} ,
29
30
env_var, install,
@@ -579,15 +580,21 @@ impl<'a> Toolchain<'a> {
579
580
Ok ( ( ) )
580
581
}
581
582
582
- /// Get the list of installed targets for any toolchain
583
+ /// Get the list of installed components for any toolchain
583
584
///
584
585
/// NB: An assumption is made that custom toolchains always have a `rustlib/components` file
585
- pub fn list_targets ( & self ) -> anyhow:: Result < Vec < TargetTriple > > {
586
+ pub fn installed_components ( & self ) -> anyhow:: Result < Vec < Component > > {
586
587
let prefix = InstallPrefix :: from ( self . path . clone ( ) ) ;
587
588
let components = Components :: open ( prefix) ?;
588
- let installed_components = components. list ( ) ?;
589
+ components. list ( )
590
+ }
589
591
590
- let targets = installed_components
592
+ /// Get the list of installed targets for any toolchain
593
+ ///
594
+ ///
595
+ pub fn installed_targets ( & self ) -> anyhow:: Result < Vec < TargetTriple > > {
596
+ let targets = self
597
+ . installed_components ( ) ?
591
598
. into_iter ( )
592
599
. filter_map ( |c| {
593
600
if c. name ( ) . starts_with ( "rust-std-" ) {
0 commit comments