1- use std:: fmt:: { self , Display } ;
2-
3- use crate :: dist:: TargetTriple ;
4-
51#[ derive( Debug ) ]
62pub ( crate ) enum Notification < ' a > {
73 /// The URL of the download is passed as the last argument, to allow us to track concurrent downloads.
8- DownloadingComponent ( & ' a str , & ' a TargetTriple , Option < & ' a TargetTriple > , & ' a str ) ,
4+ DownloadingComponent ( & ' a str , & ' a str ) ,
95 RetryingDownload ( & ' a str ) ,
106 /// Received the Content-Length of the to-be downloaded data with
117 /// the respective URL of the download (for tracking concurrent downloads).
@@ -17,23 +13,3 @@ pub(crate) enum Notification<'a> {
1713 /// Download has failed.
1814 DownloadFailed ( & ' a str ) ,
1915}
20-
21- impl Display for Notification < ' _ > {
22- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> std:: result:: Result < ( ) , fmt:: Error > {
23- use self :: Notification :: * ;
24- match self {
25- DownloadingComponent ( c, h, t, _) => {
26- if Some ( h) == t. as_ref ( ) || t. is_none ( ) {
27- write ! ( f, "downloading component '{c}'" )
28- } else {
29- write ! ( f, "downloading component '{}' for '{}'" , c, t. unwrap( ) )
30- }
31- }
32- RetryingDownload ( url) => write ! ( f, "retrying download for '{url}'" ) ,
33- DownloadContentLengthReceived ( len, _) => write ! ( f, "download size is: '{len}'" ) ,
34- DownloadDataReceived ( data, _) => write ! ( f, "received some data of size {}" , data. len( ) ) ,
35- DownloadFinished ( _) => write ! ( f, "download finished" ) ,
36- DownloadFailed ( _) => write ! ( f, "download failed" ) ,
37- }
38- }
39- }
0 commit comments