Enum texlang::command::Command

source ·
pub enum Command<S> {
    Expansion(ExpansionFn<S>, Option<Tag>),
    Macro(Rc<Macro>),
    Execution(ExecutionFn<S>, Option<Tag>),
    Variable(Rc<Command<S>>),
    CharacterTokenAlias(Value),
    Character(char),
    MathCharacter(MathCode),
}
Expand description

A TeX command.

Variants§

§

Expansion(ExpansionFn<S>, Option<Tag>)

An expansion primitive that is implemented in the engine.

Examples: \the, \ifnum.

§

Macro(Rc<Macro>)

A user defined macro.

Examples: \newcommand and \include in LaTeX.

§

Execution(ExecutionFn<S>, Option<Tag>)

A non-expansion primitive that performs operations on the state.

Examples: \def, \par.

§

Variable(Rc<Command<S>>)

A command that is used to reference a variable, like a parameter or a register.

Such a command is resolved to get the variable using the function pointer it holds.

Examples: \count, \year.

§

CharacterTokenAlias(Value)

A command that aliases a character token.

Depending on the context in which this command appears it may behave like a character (when typesetting) or like an unexpandable command (when parsing integers). Created using \let\cmd=<character>.

§

Character(char)

A command that references a character.

These commands are generally created using \countdef. In the main inner loop they result in a character being typeset. In other contexts they are interpreted as numbers. In Plain TeX, \countdef 255 is used as a more efficient version of \def{255 }.

§

MathCharacter(MathCode)

A command that references a math character.

These commands are generally created using \mathchardef.

Implementations§

source§

impl<S> Command<S>

source

pub fn tag(&self) -> Option<Tag>

Gets the tag associated to this command, or None if the command has no tag.

Trait Implementations§

source§

impl<S> Clone for Command<S>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S> Display for Command<S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S> From<Command<S>> for BuiltIn<S>

source§

fn from(cmd: Command<S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<S> RefUnwindSafe for Command<S>

§

impl<S> !Send for Command<S>

§

impl<S> !Sync for Command<S>

§

impl<S> Unpin for Command<S>

§

impl<S> UnwindSafe for Command<S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.