Skip to content

Commit d8fada9

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 9aacdc0 commit d8fada9

File tree

3 files changed

+275
-2
lines changed

3 files changed

+275
-2
lines changed

opt/definitions.rs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,21 @@ pub struct Monos {
370370
/// 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 generic function.
385+
/// 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,15 @@ 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 { u32::MAX }
426+
else { self.max_generics }
407427
}
408428

409429
/// The maximum number of individual monomorphizations to list for each
410430
/// generic function.
411431
pub fn max_monos(&self) -> u32 {
412-
self.max_monos
432+
if self.all_generics_and_monos || self.all_monos { u32::MAX }
433+
else { self.max_monos }
413434
}
414435

415436
/// Set whether to hide individual monomorphizations and only show the
@@ -421,12 +442,22 @@ impl Monos {
421442
/// Set the maximum number of generics to list.
422443
pub fn set_max_generics(&mut self, max: u32) {
423444
self.max_generics = max;
445+
self.all_generics = false;
446+
if self.all_generics_and_monos {
447+
self.all_generics_and_monos = false;
448+
self.all_monos = true;
449+
}
424450
}
425451

426452
/// Set the maximum number of individual monomorphizations to list for each
427453
/// generic function.
428454
pub fn set_max_monos(&mut self, max: u32) {
429455
self.max_monos = max;
456+
self.all_monos = false;
457+
if self.all_generics_and_monos {
458+
self.all_generics_and_monos = false;
459+
self.all_generics = true;
460+
}
430461
}
431462
}
432463

0 commit comments

Comments
 (0)