markdown_composer/builders/
list.rs1use crate::types::list::{List, ListItem};
2
3#[derive(Clone, Debug, Default)]
4pub struct ListBuilder {
5 items: Vec<ListItem>,
6}
7
8impl ListBuilder {
9 pub fn new() -> Self {
10 Self::default()
11 }
12
13 #[deprecated(note = "Please use the `append` function instead.", since = "0.3.0")]
14 pub fn add(mut self, item: impl Into<ListItem>) -> Self {
15 self.items.push(item.into());
16 self
17 }
18
19 pub fn append(mut self, item: impl Into<ListItem>) -> Self {
20 self.items.push(item.into());
21 self
22 }
23
24 pub fn ordered(self) -> List {
25 List::ordered_with(self.items)
26 }
27
28 pub fn unordered(self) -> List {
29 List::unordered_with(self.items)
30 }
31}
32
33impl List {
34 pub fn builder() -> ListBuilder {
35 ListBuilder::new()
36 }
37}