List

Struct List 

Source
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: ListKind

The kind of list this is.

Implementations§

Source§

impl List

Source

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}
Source

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}
Source

pub fn iter(&self) -> Iter<'_, Item>

Iterate over the items in the list.

Trait Implementations§

Source§

impl Clone for List

Source§

fn clone(&self) -> List

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for List

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<List> for Element

Source§

fn from(other: List) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for List

Source§

fn eq(&self, other: &List) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.