latexify

Trait 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"

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Latexify for i8

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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 usize

Source§

type Context = ()

Source§

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

Source§

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

Implementors§