Enum PrimitiveCommand

Source
pub enum PrimitiveCommand<ET: EngineTypes> {
Show 18 variants Conditional(fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<bool, ET>), Expandable(fn(&mut EngineReferences<'_, ET>, &mut Vec<ET::Token>, ET::Token) -> TeXResult<(), ET>), SimpleExpandable(fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<(), ET>), Unexpandable { scope: CommandScope, apply: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<(), ET>, }, Assignment(fn(&mut EngineReferences<'_, ET>, ET::Token, bool) -> TeXResult<(), ET>), Int { read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<ET::Int, ET>, assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>, }, Dim { read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<ET::Dim, ET>, assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>, }, Skip { read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Skip<ET::Dim>, ET>, assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>, }, MuSkip { read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<MuSkip<ET::MuDim>, ET>, assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>, }, FontCmd { read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<ET::Font, ET>, assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>, }, Box(fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Either<Option<TeXBox<ET>>, BoxInfo<ET>>, ET>), PrimitiveInt, PrimitiveDim, PrimitiveSkip, PrimitiveMuSkip, PrimitiveToks, Whatsit { get: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Option<Box<WhatsitFunction<ET>>>, ET>, immediate: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<(), ET>, the: Option<fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Vec<ET::Token>, ET>>, }, Relax,
}
Expand description

A primitive command defined from the outset. All of the fn methods are called with (at least) the current EngineReferences and the Token that triggered the command.

Variants§

§

Conditional(fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<bool, ET>)

A conditional, e.g. \ifnum, \ifx, etc.

§

Expandable(fn(&mut EngineReferences<'_, ET>, &mut Vec<ET::Token>, ET::Token) -> TeXResult<(), ET>)

An expandable primitive, e.g. \the, \number, etc. - should push its expansion to the Vec argument.

§

SimpleExpandable(fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<(), ET>)

An expandable primitive that does not actually produce any tokens, or does via more complicated means than simply returning a Vec<ET::Token> - e.g. \csname, \input, \else, etc.

§

Unexpandable

A primitive that cannot be expanded, e.g. \relax, \end, etc. See CommandScope.

Fields

§apply: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<(), ET>
§

Assignment(fn(&mut EngineReferences<'_, ET>, ET::Token, bool) -> TeXResult<(), ET>)

An assignment primitive, e.g. \def, \advance - basically, an unexpandable primitive that causes \afterassignment to be inserted.

§

Int

A primitive that yields an integer value if one is expected, or optionally can assign one if not; e.g. \count.

Fields

§read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<ET::Int, ET>
§assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>
§

Dim

A primitive that yields a dimension value if one is expected, or optionally can assign one if not; e.g. \dimen.

Fields

§read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<ET::Dim, ET>
§assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>
§

Skip

A primitive that yields a skip value if one is expected, or optionally can assign one if not; e.g. \skip.

Fields

§read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Skip<ET::Dim>, ET>
§assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>
§

MuSkip

A primitive that yields a muskip value if one is expected, or optionally can assign one if not; e.g. \muskip.

Fields

§read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<MuSkip<ET::MuDim>, ET>
§assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>
§

FontCmd

A primitive that yields a Font if one is expected, or optionally can assign one if not; e.g. \font.

Fields

§read: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<ET::Font, ET>
§assign: Option<for<'a, 'b> fn(&'a mut EngineReferences<'b, ET>, ET::Token, bool) -> TeXResult<(), ET>>
§

Box(fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Either<Option<TeXBox<ET>>, BoxInfo<ET>>, ET>)

A primitive that yields either a finished TeXBox, or opens a new one, depending on the case of the return value. Used for e.g. \setbox or \raise, which may be followed by a finished box (e.g. \box0) or a new box (e.g. \hbox{...}).

§

PrimitiveInt

A primitive assignable integer value, e.g. \hangindent or \tolerance.

§

PrimitiveDim

A primitive assignable dimension value, e.g. \parindent or \hsize.

§

PrimitiveSkip

A primitive assignable skip value, e.g. \parskip or \lineskip.

§

PrimitiveMuSkip

A primitive assignable muskip value, e.g. \thinmuskip or \medmuskip.

§

PrimitiveToks

A primitive assignable token list, e.g. \everypar or \output.

§

Whatsit

A Whatsit, e.g. \write, \special, etc. - if following an \immediate, the immediate function is called, otherwise, get may return a (boxed) continuation to be called at shipout.

Fields

§get: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Option<Box<WhatsitFunction<ET>>>, ET>
§immediate: fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<(), ET>
§the: Option<fn(&mut EngineReferences<'_, ET>, ET::Token) -> TeXResult<Vec<ET::Token>, ET>>
§

Relax

\relax - does nothing.

Implementations§

Source§

impl<ET: EngineTypes> PrimitiveCommand<ET>

Source

pub fn the<F: FnMut(&mut EngineAux<ET>, &ET::State, &mut ET::Gullet, ET::Token)>( &self, engine: &mut EngineReferences<'_, ET>, token: ET::Token, name: PrimitiveIdentifier, cont: F, ) -> TeXResult<(), ET>

implements \the for this command, e.g. \the\count0 or \the\font.

§Errors

If self is not allowed after \the

Trait Implementations§

Source§

impl<ET: Clone + EngineTypes> Clone for PrimitiveCommand<ET>
where for<'a, 'b, 'a, 'b, 'a, 'b, 'a, 'b, 'a, 'b> ET::Token: Clone, ET::Int: Clone, ET::Dim: Clone, ET::MuDim: Clone, ET::Font: Clone,

Source§

fn clone(&self) -> PrimitiveCommand<ET>

Returns a duplicate 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<ET: Debug + EngineTypes> Debug for PrimitiveCommand<ET>
where for<'a, 'b, 'a, 'b, 'a, 'b, 'a, 'b, 'a, 'b> ET::Token: Debug, ET::Int: Debug, ET::Dim: Debug, ET::MuDim: Debug, ET::Font: Debug,

Source§

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

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

impl<ET: Copy + EngineTypes> Copy for PrimitiveCommand<ET>
where for<'a, 'b, 'a, 'b, 'a, 'b, 'a, 'b, 'a, 'b> ET::Token: Copy, ET::Int: Copy, ET::Dim: Copy, ET::MuDim: Copy, ET::Font: Copy,

Auto Trait Implementations§

§

impl<ET> Freeze for PrimitiveCommand<ET>

§

impl<ET> RefUnwindSafe for PrimitiveCommand<ET>

§

impl<ET> Send for PrimitiveCommand<ET>

§

impl<ET> Sync for PrimitiveCommand<ET>

§

impl<ET> Unpin for PrimitiveCommand<ET>

§

impl<ET> UnwindSafe for PrimitiveCommand<ET>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<ET, Err, A> IntoErr<ET, Err> for A
where ET: EngineTypes, Err: From<A>,

Source§

fn into_err( self, _aux: &EngineAux<ET>, _state: &<ET as EngineTypes>::State, ) -> Err

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.