@@ -124,14 +124,26 @@ pub(crate) fn read_line() -> Result<String> {
124
124
. context ( "unable to read from stdin for confirmation" )
125
125
}
126
126
127
- # [ derive ( Default ) ]
128
- struct NotifyOnConsole {
127
+ pub ( super ) struct Notifier {
128
+ tracker : Arc < Mutex < DownloadTracker > > ,
129
129
ram_notice_shown : RefCell < bool > ,
130
130
verbose : bool ,
131
131
}
132
132
133
- impl NotifyOnConsole {
134
- fn handle ( & self , n : Notification < ' _ > ) {
133
+ impl Notifier {
134
+ pub ( super ) fn new ( verbose : bool , quiet : bool ) -> Self {
135
+ Self {
136
+ tracker : DownloadTracker :: new_with_display_progress ( !quiet) ,
137
+ ram_notice_shown : RefCell :: new ( false ) ,
138
+ verbose,
139
+ }
140
+ }
141
+
142
+ pub ( super ) fn handle ( & self , n : Notification < ' _ > ) {
143
+ if self . tracker . lock ( ) . unwrap ( ) . handle_notification ( & n) {
144
+ return ;
145
+ }
146
+
135
147
if let Notification :: Install ( dist_notifications:: Notification :: Utils (
136
148
util_notifications:: Notification :: SetDefaultBufferSize ( _) ,
137
149
) ) = & n
@@ -167,30 +179,6 @@ impl NotifyOnConsole {
167
179
}
168
180
}
169
181
170
- struct Notifier {
171
- tracker : Arc < Mutex < DownloadTracker > > ,
172
- notifier : NotifyOnConsole ,
173
- }
174
-
175
- impl Notifier {
176
- fn new ( verbose : bool , quiet : bool ) -> Self {
177
- Self {
178
- tracker : DownloadTracker :: new_with_display_progress ( !quiet) ,
179
- notifier : NotifyOnConsole {
180
- verbose,
181
- ..Default :: default ( )
182
- } ,
183
- }
184
- }
185
-
186
- fn handle ( & self , n : Notification < ' _ > ) {
187
- if self . tracker . lock ( ) . unwrap ( ) . handle_notification ( & n) {
188
- return ;
189
- }
190
- self . notifier . handle ( n) ;
191
- }
192
- }
193
-
194
182
#[ cfg_attr( feature = "otel" , tracing:: instrument) ]
195
183
pub ( crate ) fn set_globals ( current_dir : PathBuf , verbose : bool , quiet : bool ) -> Result < Cfg > {
196
184
let notifier = Notifier :: new ( verbose, quiet) ;
0 commit comments