[][src]Struct latex::Document

pub struct Document {
    pub class: DocumentClass,
    pub preamble: Preamble,
    // some fields omitted
}

The root Document node.

Fields

class: DocumentClass

The document class.

preamble: Preamble

The Document's preamble.

Methods

impl Document[src]

pub fn new(document_class: DocumentClass) -> Self[src]

Create a new Document with the specified DocumentClass.

pub fn push<E>(&mut self, element: E) -> &mut Self where
    E: Into<Element>, 
[src]

Add an element to the Document.

To make this work as seamlessly as possible, it will accept anything which can be converted into an Element using into() and supports the builder pattern with method chaining.

pub fn iter(&self) -> Iter<Element>[src]

Iterate over the Elements in this document.

pub fn push_doc(&mut self, doc: &Document) -> &mut Self[src]

A convience method to include one document into another by cloning the individual nodes.

Methods from Deref<Target = Vec<Element>>

pub fn capacity(&self) -> usize1.0.0[src]

Returns the number of elements the vector can hold without reallocating.

Examples

let vec: Vec<i32> = Vec::with_capacity(10);
assert_eq!(vec.capacity(), 10);

pub fn as_slice(&self) -> &[T]1.7.0[src]

Extracts a slice containing the entire vector.

Equivalent to &s[..].

Examples

use std::io::{self, Write};
let buffer = vec![1, 2, 3, 5, 8];
io::sink().write(buffer.as_slice()).unwrap();

pub fn len(&self) -> usize1.0.0[src]

Returns the number of elements in the vector, also referred to as its 'length'.

Examples

let a = vec![1, 2, 3];
assert_eq!(a.len(), 3);

pub fn is_empty(&self) -> bool1.0.0[src]

Returns true if the vector contains no elements.

Examples

let mut v = Vec::new();
assert!(v.is_empty());

v.push(1);
assert!(!v.is_empty());

Trait Implementations

impl Default for Document[src]

impl Clone for Document[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Extend<Element> for Document[src]

impl PartialEq<Document> for Document[src]

impl Deref for Document[src]

type Target = Vec<Element>

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

A shortcut to let you iterate over the elements in the Document.

impl Debug for Document[src]

Auto Trait Implementations

impl Send for Document

impl Sync for Document

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]