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.
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
Dim
A primitive that yields a dimension value if one is expected, or optionally can assign one if not;
e.g. \dimen.
Fields
Skip
A primitive that yields a skip value if one is expected, or optionally can assign one if not;
e.g. \skip.
Fields
MuSkip
A primitive that yields a muskip value if one is expected, or optionally can assign one if not;
e.g. \muskip.
Fields
FontCmd
A primitive that yields a Font if one is expected, or optionally can assign one if not;
e.g. \font.
Fields
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>Relax
\relax - does nothing.
Implementations§
Source§impl<ET: EngineTypes> PrimitiveCommand<ET>
impl<ET: EngineTypes> PrimitiveCommand<ET>
Sourcepub 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>
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>
impl<ET: Clone + EngineTypes> Clone for PrimitiveCommand<ET>
Source§fn clone(&self) -> PrimitiveCommand<ET>
fn clone(&self) -> PrimitiveCommand<ET>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<ET: Debug + EngineTypes> Debug for PrimitiveCommand<ET>
impl<ET: Debug + EngineTypes> Debug for PrimitiveCommand<ET>
impl<ET: Copy + EngineTypes> Copy for PrimitiveCommand<ET>
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> UnsafeUnpin for PrimitiveCommand<ET>
impl<ET> UnwindSafe for PrimitiveCommand<ET>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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