22
22
mod custom_button;
23
23
//use custom_button::CustomButton;
24
24
mod processor;
25
- mod subprocess;
26
25
mod property;
26
+ mod subprocess;
27
27
use property:: Property ;
28
28
mod formatter;
29
29
use formatter:: Formatter ;
@@ -169,29 +169,28 @@ fn build_ui(app: &Application) {
169
169
let p: Property = Property :: new ( & proc, "" , "" , & form, & 1 ) ;
170
170
171
171
let vecc: Vec < Vec < String > > = vec ! [
172
- vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
173
- vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ]
172
+ vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
173
+ vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ] ,
174
174
] ;
175
175
match p. parse ( vecc, |input : Vec < String > | {
176
176
Some ( input. get ( 0 ) . unwrap ( ) . to_string ( ) )
177
177
} ) {
178
178
Some ( results) => {
179
179
println ! ( "size: {}" , results. len( ) ) ;
180
180
for item in results {
181
- println ! ( "item: {}" , item) ;
181
+ println ! ( "item: {}" , item) ;
182
182
}
183
- } ,
183
+ }
184
184
None => println ! ( "Something's gone really wrong!" ) ,
185
185
}
186
186
187
-
188
187
// PERCENT
189
188
let proc: Processor = Processor :: new ( "nvidia-settings" , "-q GpuUUID -t" ) ;
190
189
let form: Formatter = Formatter :: new ( ) ;
191
190
let p: Property = Property :: new ( & proc, "" , "" , & form, & 1 ) ;
192
191
let vecc: Vec < Vec < String > > = vec ! [
193
- vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
194
- vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ]
192
+ vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
193
+ vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ] ,
195
194
] ;
196
195
match p. parse ( vecc, |input : Vec < String > | {
197
196
// Grab input
@@ -206,20 +205,19 @@ fn build_ui(app: &Application) {
206
205
Some ( results) => {
207
206
println ! ( "size: {}" , results. len( ) ) ;
208
207
for item in results {
209
- println ! ( "item: {}" , item) ;
208
+ println ! ( "item: {}" , item) ;
210
209
}
211
- } ,
210
+ }
212
211
None => println ! ( "Something's gone really wrong when formatting GENERIC info" ) ,
213
212
}
214
213
215
-
216
214
// POWER
217
215
let proc: Processor = Processor :: new ( "nvidia-settings" , "-q GpuUUID -t" ) ;
218
216
let form: Formatter = Formatter :: new ( ) ;
219
217
let p: Property = Property :: new ( & proc, "" , "" , & form, & 1 ) ;
220
218
let vecc: Vec < Vec < String > > = vec ! [
221
- vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
222
- vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ]
219
+ vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
220
+ vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ] ,
223
221
] ;
224
222
match p. parse ( vecc, |input : Vec < String > | {
225
223
// Grab input
@@ -239,32 +237,31 @@ fn build_ui(app: &Application) {
239
237
240
238
// Return result
241
239
Some ( output)
242
- } ,
240
+ }
243
241
Err ( _) => {
244
242
//this should catch "" etc
245
243
println ! ( "Not a valid number" ) ;
246
244
247
245
None
248
- } ,
246
+ }
249
247
}
250
248
} ) {
251
249
Some ( results) => {
252
250
println ! ( "size: {}" , results. len( ) ) ;
253
251
for item in results {
254
- println ! ( "item: {}" , item) ;
252
+ println ! ( "item: {}" , item) ;
255
253
}
256
- } ,
254
+ }
257
255
None => println ! ( "Something's gone really wrong when formatting POWER info" ) ,
258
256
}
259
257
260
-
261
258
// MEMORY
262
259
let proc: Processor = Processor :: new ( "nvidia-settings" , "-q GpuUUID -t" ) ;
263
260
let form: Formatter = Formatter :: new ( ) ;
264
261
let p: Property = Property :: new ( & proc, "" , "" , & form, & 1 ) ;
265
262
let vecc: Vec < Vec < String > > = vec ! [
266
- vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
267
- vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ]
263
+ vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
264
+ vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ] ,
268
265
] ;
269
266
match p. parse ( vecc, |input : Vec < String > | {
270
267
// Grab input
@@ -290,41 +287,40 @@ fn build_ui(app: &Application) {
290
287
291
288
// Return result
292
289
Some ( output)
293
- } ,
290
+ }
294
291
Err ( _) => {
295
292
//this should catch "" etc
296
293
println ! ( "Not a valid number" ) ;
297
294
298
295
None
299
- } ,
296
+ }
300
297
}
301
- } ,
298
+ }
302
299
Err ( _) => {
303
300
//this should catch "" etc
304
301
//TODO: fix this!
305
302
println ! ( "Not a valid number" ) ;
306
303
307
304
None
308
- } ,
305
+ }
309
306
}
310
307
} ) {
311
308
Some ( results) => {
312
309
println ! ( "size: {}" , results. len( ) ) ;
313
310
for item in results {
314
- println ! ( "item: {}" , item) ;
311
+ println ! ( "item: {}" , item) ;
315
312
}
316
- } ,
313
+ }
317
314
None => println ! ( "Something's gone really wrong when formatting MEMORY info" ) ,
318
315
}
319
316
320
-
321
317
// TEMPERATURE
322
318
let proc: Processor = Processor :: new ( "nvidia-settings" , "-q GpuUUID -t" ) ;
323
319
let form: Formatter = Formatter :: new ( ) ;
324
320
let p: Property = Property :: new ( & proc, "" , "" , & form, & 1 ) ;
325
321
let vecc: Vec < Vec < String > > = vec ! [
326
- vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
327
- vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ]
322
+ vec![ "1.68" . to_string( ) , "2.01" . to_string( ) ] ,
323
+ vec![ "3.83" . to_string( ) , "4.22" . to_string( ) ] ,
328
324
] ;
329
325
match p. parse ( vecc, |input : Vec < String > | {
330
326
// Grab input
@@ -334,7 +330,7 @@ fn build_ui(app: &Application) {
334
330
#[ derive( Debug , PartialEq , Eq ) ]
335
331
enum TemperatureUnit {
336
332
CELCIUS = 0 ,
337
- FAHRENHEIT = 1
333
+ FAHRENHEIT = 1 ,
338
334
}
339
335
let current_unit: TemperatureUnit = TemperatureUnit :: CELCIUS ;
340
336
//let current_unit: TemperatureUnit = TemperatureUnit::FAHRENHEIT;
@@ -343,7 +339,7 @@ fn build_ui(app: &Application) {
343
339
if current_unit == TemperatureUnit :: CELCIUS {
344
340
// Apply temperature unit
345
341
output. push ( char:: from_u32 ( 0x00B0 ) . unwrap ( ) ) ;
346
- output. push ( 'C' ) ;
342
+ output. push ( 'C' ) ;
347
343
} else if current_unit == TemperatureUnit :: FAHRENHEIT {
348
344
match output. parse :: < f64 > ( ) {
349
345
Ok ( temp) => {
@@ -362,13 +358,13 @@ fn build_ui(app: &Application) {
362
358
363
359
// Return result
364
360
Some ( f_output)
365
- } ,
361
+ }
366
362
Err ( _) => {
367
363
//this should catch "" etc
368
364
println ! ( "Not a valid number" ) ;
369
365
370
366
None
371
- } ,
367
+ }
372
368
} ;
373
369
}
374
370
@@ -378,9 +374,9 @@ fn build_ui(app: &Application) {
378
374
Some ( results) => {
379
375
println ! ( "size: {}" , results. len( ) ) ;
380
376
for item in results {
381
- println ! ( "item: {}" , item) ;
377
+ println ! ( "item: {}" , item) ;
382
378
}
383
- } ,
379
+ }
384
380
None => println ! ( "Something's gone really wrong when formatting TEMPERATURE info" ) ,
385
381
}
386
382
} ) ;
0 commit comments