pub struct List {
pub kind: ListKind,
/* private fields */
}Expand description
A list (either dot points or numbered).
§Examples
A list can be used like so:
use latex::{List, ListKind};
let mut list = List::new(ListKind::Itemize);
list.push("Hello").push("From").push("Some").push("Dot-points");Calling the render() method on the list will then give something like
this:
\begin{itemize}
\item Hello
\item From
\item Some
\item Dot-points
\end{itemize}Fields§
§kind: ListKindThe kind of list this is.
Implementations§
Source§impl List
impl List
Sourcepub fn new(kind: ListKind) -> List
pub fn new(kind: ListKind) -> List
Create an empty list of the specified type.
Examples found in repository?
examples/complex.rs (line 42)
29fn first_section() -> Section {
30 let mut section_1 = Section::new("Introduction");
31 section_1.push("This is an example paragraph.");
32
33 let mut equations = Align::new();
34 equations
35 .push("y &= mx + c")
36 .push(Equation::with_label("quadratic", "y &= a x^2 + bx + c"));
37
38 section_1
39 .push("Please refer to the equations below:")
40 .push(equations);
41
42 let mut objectives = List::new(ListKind::Enumerate);
43 objectives
44 .push(r"Demonstrate how to use the \textit{latex} library.")
45 .push("Create a reasonably complex document")
46 .push("???")
47 .push("PROFIT!");
48
49 section_1.push("Here are our objectives:").push(objectives);
50
51 section_1
52}Sourcepub fn push<S: AsRef<str>>(&mut self, item: S) -> &mut Self
pub fn push<S: AsRef<str>>(&mut self, item: S) -> &mut Self
Add an element to the list.
Examples found in repository?
examples/complex.rs (line 44)
29fn first_section() -> Section {
30 let mut section_1 = Section::new("Introduction");
31 section_1.push("This is an example paragraph.");
32
33 let mut equations = Align::new();
34 equations
35 .push("y &= mx + c")
36 .push(Equation::with_label("quadratic", "y &= a x^2 + bx + c"));
37
38 section_1
39 .push("Please refer to the equations below:")
40 .push(equations);
41
42 let mut objectives = List::new(ListKind::Enumerate);
43 objectives
44 .push(r"Demonstrate how to use the \textit{latex} library.")
45 .push("Create a reasonably complex document")
46 .push("???")
47 .push("PROFIT!");
48
49 section_1.push("Here are our objectives:").push(objectives);
50
51 section_1
52}Trait Implementations§
impl StructuralPartialEq for List
Auto Trait Implementations§
impl Freeze for List
impl RefUnwindSafe for List
impl Send for List
impl Sync for List
impl Unpin for List
impl UnwindSafe for List
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