Trait latexify::Latexify

source ·
pub trait Latexify {
    type Context;

    // Required method
    fn fmt<W: Write>(&self, c: &Self::Context, f: &mut W) -> Result;

    // Provided method
    fn to_latex(&self, config: &Self::Context) -> String { ... }
}
Expand description

A trait for LaTeX representation.

Required Associated Types§

source

type Context

The context of LaTeX representation.

Required Methods§

source

fn fmt<W: Write>(&self, c: &Self::Context, f: &mut W) -> Result

Write LaTeX representation to the formatter.

Examples
use latexify::Latexify;
let mut buffer = String::new();
Latexify::fmt(&0, &mut buffer)?;
println!("{}", buffer); // 0
//

Provided Methods§

source

fn to_latex(&self, config: &Self::Context) -> String

Get the LaTeX string of raw object.

Examples
use latexify::Latexify;
0.to_latex(); // "0"

Implementations on Foreign Types§

source§

impl Latexify for usize

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for isize

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for i16

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for u64

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for u32

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for u128

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for u8

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for i64

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for u16

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for i32

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for i8

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

source§

impl Latexify for i128

§

type Context = ()

source§

fn fmt<W: Write>(&self, _: &Self::Context, f: &mut W) -> Result

source§

fn to_latex(&self, _: &Self::Context) -> String

Implementors§