pub struct ElementList<T: Tex> { /* private fields */ }
Expand description

A linked list of elements

Implementations§

Creates a new empty list

Examples found in repository?
examples/doc_example.rs (line 9)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() -> Result<(), Error> {
    let metadata = Metadata::new("Author", "date", "title", 11, "book", true);
    let mut list = ElementList::new(&metadata);
    let part = Part::new("part");
    let chapter = Chapter::new("chapter");
    let header1 = Header::new("header1", 1);
    let header2 = Header::new("header2", 2);
    let text = Text::new("text", TextType::Normal);
    let pkg = Package::new("dramatist");
    list.push_array(Elements![part, chapter, header1, header2, text, pkg]);
    /*
        To compile, use the `compile` feature
        list.compile(PathBuf::from("test.pdf");
        To write to single tex file:
        list.write(PathBuf::from("test.tex"))?;
        To split write Packages and Main file:
        list.write_split(PathBuf::from("main.tex"), PathBuf::from("structure.tex"))?;
        To print:
        list.print_tex();
    */
    Ok(())
}

Adds in \newpage text as next element in the list

Pushes an element to the end of the list

Pushes an element vector into the list

Examples found in repository?
examples/doc_example.rs (line 16)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
fn main() -> Result<(), Error> {
    let metadata = Metadata::new("Author", "date", "title", 11, "book", true);
    let mut list = ElementList::new(&metadata);
    let part = Part::new("part");
    let chapter = Chapter::new("chapter");
    let header1 = Header::new("header1", 1);
    let header2 = Header::new("header2", 2);
    let text = Text::new("text", TextType::Normal);
    let pkg = Package::new("dramatist");
    list.push_array(Elements![part, chapter, header1, header2, text, pkg]);
    /*
        To compile, use the `compile` feature
        list.compile(PathBuf::from("test.pdf");
        To write to single tex file:
        list.write(PathBuf::from("test.tex"))?;
        To split write Packages and Main file:
        list.write_split(PathBuf::from("main.tex"), PathBuf::from("structure.tex"))?;
        To print:
        list.print_tex();
    */
    Ok(())
}

Pops an element at the end of the list

Pushes element to the front of the list

Pops an element in the front of the list

Walks the list and returns a combined latex string

Walks the list and returns a split latex string separating Packages level

Writes ElementList into a latex file

Writes ElementList into two latex files splitting the main content and structure path for packages

Prints the whole tex source code

Returns &self.list to Vec<Element<Any>>

returns the list’s metadata

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.