(&self, t: DisplayFormatType, f: &mut Formatter)
| 31 | |
| 32 | impl DisplayAs for FileGroupsDisplay<'_> { |
| 33 | fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult { |
| 34 | let n_groups = self.0.len(); |
| 35 | let groups = if n_groups == 1 { "group" } else { "groups" }; |
| 36 | write!(f, "{{{n_groups} {groups}: [")?; |
| 37 | match t { |
| 38 | DisplayFormatType::Default | DisplayFormatType::TreeRender => { |
| 39 | // To avoid showing too many partitions |
| 40 | let max_groups = 5; |
| 41 | fmt_up_to_n_elements(self.0, max_groups, f, |group, f| { |
| 42 | FileGroupDisplay(group).fmt_as(t, f) |
| 43 | })?; |
| 44 | } |
| 45 | DisplayFormatType::Verbose => { |
| 46 | fmt_elements_split_by_commas(self.0.iter(), f, |group, f| { |
| 47 | FileGroupDisplay(group).fmt_as(t, f) |
| 48 | })? |
| 49 | } |
| 50 | } |
| 51 | write!(f, "]}}") |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /// A wrapper to customize partitioned group of files display |
nothing calls this directly
no test coverage detected