Trait Token

Source
pub trait Token:
    PartialEq
    + Clone
    + Display
    + Debug
    + 'static {
    type Char: CharType;

    // Required methods
    fn base(&self) -> &BaseToken<Self::Char>;
    fn new(
        base: BaseToken<Self::Char>,
        sourceref: Option<(Ptr<String>, (usize, usize), (usize, usize))>,
    ) -> Self;
    fn with_ref(&self, token: &Ptr<Self>, cmd: &Ptr<Command<Self>>) -> Self;
    fn sourceref_trace(&self) -> Option<String>;
    fn from_str(s: String) -> Vec<Self>;

    // Provided method
    fn catcode(&self) -> CategoryCode { ... }
}

Required Associated Types§

Required Methods§

Source

fn base(&self) -> &BaseToken<Self::Char>

The actual TeX-relevant data of the Token

Source

fn new( base: BaseToken<Self::Char>, sourceref: Option<(Ptr<String>, (usize, usize), (usize, usize))>, ) -> Self

Construct a new Token from a BaseToken

Source

fn with_ref(&self, token: &Ptr<Self>, cmd: &Ptr<Command<Self>>) -> Self

Clone this Token with a new SourceReference of type SourceReference::Expansion (if the Token is a TokenWithSourceref).

Source

fn sourceref_trace(&self) -> Option<String>

Source

fn from_str(s: String) -> Vec<Self>

Parse a string into a list of Tokens of CategoryCode::Other

Provided Methods§

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.

Implementors§