@@ -34,6 +34,34 @@ pub(crate) struct DistributableToolchain<'a> {
3434}
3535
3636impl < ' a > DistributableToolchain < ' a > {
37+ #[ tracing:: instrument( level = "trace" , err( level = "trace" ) , skip_all) ]
38+ pub ( crate ) async fn install (
39+ cfg : & ' a Cfg < ' a > ,
40+ toolchain : & ToolchainDesc ,
41+ components : & [ & str ] ,
42+ targets : & [ & str ] ,
43+ profile : Profile ,
44+ force : bool ,
45+ ) -> anyhow:: Result < ( UpdateStatus , Self ) > {
46+ let hash_path = cfg. get_hash_file ( toolchain, true ) ?;
47+ let status = InstallMethod :: Dist ( DistOptions {
48+ cfg,
49+ toolchain,
50+ profile,
51+ update_hash : & hash_path,
52+ dl_cfg : DownloadCfg :: new ( cfg) ,
53+ force,
54+ allow_downgrade : false ,
55+ exists : false ,
56+ old_date_version : None ,
57+ components,
58+ targets,
59+ } )
60+ . install ( )
61+ . await ?;
62+ Ok ( ( status, Self :: new ( cfg, toolchain. clone ( ) ) ?) )
63+ }
64+
3765 pub ( crate ) async fn from_partial (
3866 toolchain : Option < ( PartialToolchainDesc , ActiveSource ) > ,
3967 cfg : & ' a Cfg < ' a > ,
@@ -336,34 +364,6 @@ impl<'a> DistributableToolchain<'a> {
336364 InstallPrefix :: from ( self . toolchain . path ( ) . to_owned ( ) ) . guess_v1_manifest ( )
337365 }
338366
339- #[ tracing:: instrument( level = "trace" , err( level = "trace" ) , skip_all) ]
340- pub ( crate ) async fn install (
341- cfg : & ' a Cfg < ' a > ,
342- toolchain : & ToolchainDesc ,
343- components : & [ & str ] ,
344- targets : & [ & str ] ,
345- profile : Profile ,
346- force : bool ,
347- ) -> anyhow:: Result < ( UpdateStatus , DistributableToolchain < ' a > ) > {
348- let hash_path = cfg. get_hash_file ( toolchain, true ) ?;
349- let status = InstallMethod :: Dist ( DistOptions {
350- cfg,
351- toolchain,
352- profile,
353- update_hash : & hash_path,
354- dl_cfg : DownloadCfg :: new ( cfg) ,
355- force,
356- allow_downgrade : false ,
357- exists : false ,
358- old_date_version : None ,
359- components,
360- targets,
361- } )
362- . install ( )
363- . await ?;
364- Ok ( ( status, Self :: new ( cfg, toolchain. clone ( ) ) ?) )
365- }
366-
367367 #[ tracing:: instrument( level = "trace" , err( level = "trace" ) , skip_all) ]
368368 pub ( crate ) async fn update (
369369 & mut self ,
0 commit comments