pub enum ListItem<'a, T> {
Text(T),
Nested(&'a [ListItem<'a, T>]),
}Expand description
An item of a list: a line of text, or a nested list indented under the line before it.
A flat list takes plain Display items (&["a", "b"]); nested lists take
these.
discord.js counterpart: an element of a RecursiveArray.
§Examples
use djs_formatters::{ListItem, unordered_list};
let items = [
ListItem::Text("Fruit"),
ListItem::Nested(&[ListItem::Text("Apple"), ListItem::Text("Pear")]),
ListItem::Text("Bread"),
];
assert_eq!(unordered_list(&items).to_string(), "- Fruit\n - Apple\n - Pear\n- Bread");Variants§
Trait Implementations§
impl<'a, T: Copy> Copy for ListItem<'a, T>
impl<'a, T: Eq> Eq for ListItem<'a, T>
impl<'a, T: PartialEq> StructuralPartialEq for ListItem<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for ListItem<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for ListItem<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for ListItem<'a, T>
impl<'a, T> Sync for ListItem<'a, T>where
T: Sync,
impl<'a, T> Unpin for ListItem<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for ListItem<'a, T>where
T: UnsafeUnpin,
impl<'a, T> UnwindSafe for ListItem<'a, T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more