Skip to content

Commit fbc5090

Browse files
Add --all(-generics|-monos) flags to monos command
With an additional -a shortcut for the simple --all flag that combines listing all generics and monomorphizations Also extends tests accordingly Relates to #109
1 parent e3f04f8 commit fbc5090

File tree

6 files changed

+688
-3
lines changed

6 files changed

+688
-3
lines changed

opt/definitions.rs

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,24 @@ pub struct Monos {
367367
max_generics: u32,
368368

369369
/// The maximum number of individual monomorphizations to list for each
370-
/// generic function.
370+
/// listed generic function.
371371
#[structopt(short = "n", long = "max-monos", default_value = "10")]
372372
max_monos: u32,
373+
374+
/// List all generics and all of their individual monomorphizations.
375+
/// If combined with -g then monomorphizations are hidden.
376+
/// Overrides -m <max_generics> and -n <max_monos>
377+
#[structopt(short = "a", long = "all")]
378+
all_generics_and_monos: bool,
379+
380+
/// List all generics. Overrides -m <max_generics>
381+
#[structopt(long = "all-generics")]
382+
all_generics: bool,
383+
384+
/// List all individual monomorphizations for each listed generic
385+
/// function. Overrides -n <max_monos>
386+
#[structopt(long = "all-monos")]
387+
all_monos: bool,
373388
}
374389

375390
impl Default for Monos {
@@ -385,6 +400,10 @@ impl Default for Monos {
385400
only_generics: false,
386401
max_generics: 10,
387402
max_monos: 10,
403+
404+
all_generics_and_monos: false,
405+
all_generics: false,
406+
all_monos: false,
388407
}
389408
}
390409
}
@@ -403,13 +422,21 @@ impl Monos {
403422

404423
/// The maximum number of generics to list.
405424
pub fn max_generics(&self) -> u32 {
406-
self.max_generics
425+
if self.all_generics_and_monos || self.all_generics {
426+
u32::MAX
427+
} else {
428+
self.max_generics
429+
}
407430
}
408431

409432
/// The maximum number of individual monomorphizations to list for each
410433
/// generic function.
411434
pub fn max_monos(&self) -> u32 {
412-
self.max_monos
435+
if self.all_generics_and_monos || self.all_monos {
436+
u32::MAX
437+
} else {
438+
self.max_monos
439+
}
413440
}
414441

415442
/// Set whether to hide individual monomorphizations and only show the
@@ -421,12 +448,22 @@ impl Monos {
421448
/// Set the maximum number of generics to list.
422449
pub fn set_max_generics(&mut self, max: u32) {
423450
self.max_generics = max;
451+
self.all_generics = false;
452+
if self.all_generics_and_monos {
453+
self.all_generics_and_monos = false;
454+
self.all_monos = true;
455+
}
424456
}
425457

426458
/// Set the maximum number of individual monomorphizations to list for each
427459
/// generic function.
428460
pub fn set_max_monos(&mut self, max: u32) {
429461
self.max_monos = max;
462+
self.all_monos = false;
463+
if self.all_generics_and_monos {
464+
self.all_generics_and_monos = false;
465+
self.all_generics = true;
466+
}
430467
}
431468
}
432469

0 commit comments

Comments
 (0)