[][src]Struct latex::Paragraph

pub struct Paragraph {
    pub elements: Vec<ParagraphElement>,
}

A single paragraph.

Examples

Like most of the other types in this crate, the standard workflow is to create an empty Paragraph then incrementally add bits to it using method chaining and the push() method.

use latex::{Paragraph, ParagraphElement};

let mut p = Paragraph::new();
p.push("Hello ")
 .push(ParagraphElement::italic("World"))
 .push("!")
 .push(" Here is an equation ")
 .push(ParagraphElement::InlineMath("y = mx + c".to_string()))
 .push(".");

The above paragraph would get rendered to something like this:

Hello \textit{World}! Here is an equation $y = mx + c$.

Fields

elements: Vec<ParagraphElement>

A list of ParagraphElements which make up the paragraph's contents.

Methods

impl Paragraph[src]

pub fn new() -> Self[src]

Create a new paragraph.

pub fn push<P>(&mut self, elem: P) -> &mut Self where
    P: Into<ParagraphElement>, 
[src]

Add a ParagraphElement to the Paragraph.

pub fn push_text(&mut self, text: &str) -> &mut Self[src]

Add some raw text to the paragraph.

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

Iterate over the ParagraphElements in this Paragraph.

Trait Implementations

impl Default for Paragraph[src]

impl Clone for Paragraph[src]

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

Performs copy-assignment from source. Read more

impl From<Paragraph> for Element[src]

impl<'a> From<&'a str> for Paragraph[src]

impl PartialEq<Paragraph> for Paragraph[src]

impl Debug for Paragraph[src]

Auto Trait Implementations

impl Send for Paragraph

impl Sync for Paragraph

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]