Function sequence_to_list

Source
pub fn sequence_to_list<T>(
    sequence: &[T],
    indent: Indent,
    max_items: usize,
) -> Vec<String>
where T: Display,
Expand description

Returns reading-friendly textual representation of the sequence, with vertically listed items and each item indented for the indent and preceded with the dash (-). If the sequence has more than max_items the remaining items are replaced with the text “and more”.

E.g.:

  • [a] =>
    • a
  • [a, b] =>
    • a
    • b
  • [a, b, c, d, e] =>
    • a
    • b
    • and three more

Panics if the sequence is empty, or max_items is zero.