grouped_list
Headed list molecule with a summary line and pre-rendered rows.
struct Component
pub struct Component<'a>A headed list section with heading, summary, and rows.
| Field | Type | Description |
|---|---|---|
heading |
&'a str | Section heading, in the list.heading style. |
rows |
Vec<String> | Pre-rendered rows, printed as is after a blank line. |
summary |
String | Text beside the heading, such as a count, in the list.summary style. |
Implements Display.
Component::new
pub fn new(heading: &'a str, summary: impl Into<String>) -> SelfCreate a grouped list with the given heading and summary line.
| Parameter | Type | Description |
|---|---|---|
heading |
&'a str | the section heading |
summary |
impl Into<String> | the text shown two spaces after the heading |
| returns | Self | The list with no rows. |
Component::row
pub fn row(self, row: impl Into<String>) -> SelfAdd a pre-rendered row to the list.
| Parameter | Type | Description |
|---|---|---|
row |
impl Into<String> | the row text, already styled |
| returns | Self | The list with the row appended. |