pub trait Definition: Object {
Show 37 methods
// Required methods
fn invoke(&self, once_only: bool) -> Result<Tokens>;
fn invoke_primitive(&self) -> Result<Vec<Digested>>;
fn get_cs(&self) -> Cow<'_, Token>;
fn get_cs_name(&self) -> Cow<'_, str>;
fn get_alias(&self) -> Option<&String>;
fn get_parameters(&self) -> Option<&Parameters>;
fn do_absorption(
&self,
_document: &mut Document,
_whatsit: &Whatsit,
) -> Result<Vec<Node>>;
// Provided methods
fn invoke_onto_input(&self, once_only: bool) -> Result<()> { ... }
fn native_expansion(&self) -> Result<Option<Tokens>> { ... }
fn get_cs_or_alias(&self) -> Cow<'_, Token> { ... }
fn get_sizer(&self) -> Option<SizingClosure> { ... }
fn declared_mode(&self) -> Option<DeclaredMode> { ... }
fn declared_font(&self) -> Option<&FontDirective> { ... }
fn replacement_template(&self) -> Option<&'static str> { ... }
fn is_protected(&self) -> bool { ... }
fn peeks_by_futurelet(&self) -> bool { ... }
fn is_register(&self) -> bool { ... }
fn is_prefix(&self) -> bool { ... }
fn is_readonly(&self) -> bool { ... }
fn get_test(&self) -> Option<&ConditionalClosure> { ... }
fn get_conditional_type(&self) -> Option<ConditionalType> { ... }
fn read_arguments(&self) -> Result<Vec<ArgWrap>>
where Self: Sized { ... }
fn invocation(
&mut self,
args: Vec<Option<Tokens>>,
_gullet: &mut Gullet,
) -> Result<Tokens> { ... }
fn get_num_args(&self) -> usize { ... }
fn before_digest(&self) -> Option<&Vec<BeforeDigestClosure>> { ... }
fn after_digest(&self) -> Option<&Vec<DigestionClosure>> { ... }
fn after_digest_body(&self) -> Option<&Vec<DigestionClosure>> { ... }
fn capture_body(&self) -> bool { ... }
fn execute_before_digest(&self) -> Result<Vec<Digested>> { ... }
fn execute_after_digest(
&self,
whatsit: &mut Whatsit,
) -> Result<Vec<Digested>> { ... }
fn execute_after_digest_body(
&self,
whatsit: &mut Whatsit,
) -> Result<Vec<Digested>> { ... }
fn value_of(&self, _args: Vec<ArgWrap>) -> Option<RegisterValue> { ... }
fn set_value(
&self,
_value: RegisterValue,
_scope: Option<Scope>,
_args: Vec<ArgWrap>,
) -> Result<()> { ... }
fn register_type(&self) -> Option<RegisterType> { ... }
fn get_reversion_spec(&self) -> Option<Reversion> { ... }
fn get_expansion(&self) -> Option<&ExpansionBody> { ... }
fn stringify_type(&self, deftype: &str) -> String { ... }
}Required Methods§
fn invoke(&self, once_only: bool) -> Result<Tokens>
fn invoke_primitive(&self) -> Result<Vec<Digested>>
Sourcefn get_cs(&self) -> Cow<'_, Token>
fn get_cs(&self) -> Cow<'_, Token>
We can almost always return the CS by reference, except in a Register’s RefCell, where we are forced to clone
fn get_cs_name(&self) -> Cow<'_, str>
fn get_alias(&self) -> Option<&String>
fn get_parameters(&self) -> Option<&Parameters>
fn do_absorption( &self, _document: &mut Document, _whatsit: &Whatsit, ) -> Result<Vec<Node>>
Provided Methods§
Sourcefn invoke_onto_input(&self, once_only: bool) -> Result<()>
fn invoke_onto_input(&self, once_only: bool) -> Result<()>
Expand onto the input: Self::invoke’s result pushed back with crate::gullet::unread_expansion, as
the gullet’s macro expansion does. An expandable with a token-list body substitutes its arguments straight
onto the input instead (tex.web §390 macro_call).
Sourcefn native_expansion(&self) -> Result<Option<Tokens>>
fn native_expansion(&self) -> Result<Option<Tokens>>
expandable::SpecialCall::Native, for a call the gullet expands in full: only there, so a one-step
\expandafter and every other reader of the expansion get the macro’s own body.
fn get_cs_or_alias(&self) -> Cow<'_, Token>
fn get_sizer(&self) -> Option<SizingClosure>
Sourcefn declared_mode(&self) -> Option<DeclaredMode>
fn declared_mode(&self) -> Option<DeclaredMode>
The mode transitions the binding declared (DeclaredMode); None for definitions
not made by a definer that takes mode options (macros, registers, raw-TeX definitions,
a primitive built by hand). The audit reads None on a primitive or constructor as
declaring nothing.
Sourcefn declared_font(&self) -> Option<&FontDirective>
fn declared_font(&self) -> Option<&FontDirective>
The font a primitive or constructor was declared with (its font => {…} option), which its
digestion merges into the current font; None for every other definition. latex.ltx’s
\@fontswitch reads a math alphabet as a switch to the group’s end (\mathrm\relax with
\math@bgroup let to \relax, latex.ltx:14312-14321): the binding’s switch merges this font
(\lx@math@alphabet@switch, latex_constructs/sect13.rs).
Sourcefn replacement_template(&self) -> Option<&'static str>
fn replacement_template(&self) -> Option<&'static str>
The literal XML template that is a constructor’s whole construction: its replacement’s source (DefConstructor!
with a string replacement), when no construction hook (before_construct, after_construct) adds to it. None
for a closure replacement, a constructor made at run time and every other definition: what it builds cannot be
read off it (the frontmatter’s no-ink test, latexml_engine util_text.rs first_ink, counts such a whatsit as ink).
fn is_protected(&self) -> bool
Sourcefn peeks_by_futurelet(&self) -> bool
fn peeks_by_futurelet(&self) -> bool
Whether this macro peeks at the next token the way latex.ltx’s
\@ifnextchar does (1756-1760): by \futurelet, behind an unexpandable
\let. A number scan (tex.web §445) ends at such a macro instead of
expanding it (see gullet::expands_now). A binding closure that makes an
assignment as it expands carries it too when its TeX original reaches an
unexpandable token (\begingroup, \let, \relax) before it acts:
etoolbox’s \newrobustcmd and \patchcmd, amsthm’s \pushQED.
fn is_register(&self) -> bool
fn is_prefix(&self) -> bool
fn is_readonly(&self) -> bool
fn get_test(&self) -> Option<&ConditionalClosure>
fn get_conditional_type(&self) -> Option<ConditionalType>
fn read_arguments(&self) -> Result<Vec<ArgWrap>>where
Self: Sized,
fn invocation( &mut self, args: Vec<Option<Tokens>>, _gullet: &mut Gullet, ) -> Result<Tokens>
fn get_num_args(&self) -> usize
fn before_digest(&self) -> Option<&Vec<BeforeDigestClosure>>
fn after_digest(&self) -> Option<&Vec<DigestionClosure>>
fn after_digest_body(&self) -> Option<&Vec<DigestionClosure>>
fn capture_body(&self) -> bool
fn execute_before_digest(&self) -> Result<Vec<Digested>>
fn execute_after_digest(&self, whatsit: &mut Whatsit) -> Result<Vec<Digested>>
fn execute_after_digest_body( &self, whatsit: &mut Whatsit, ) -> Result<Vec<Digested>>
fn value_of(&self, _args: Vec<ArgWrap>) -> Option<RegisterValue>
Sourcefn set_value(
&self,
_value: RegisterValue,
_scope: Option<Scope>,
_args: Vec<ArgWrap>,
) -> Result<()>
fn set_value( &self, _value: RegisterValue, _scope: Option<Scope>, _args: Vec<ArgWrap>, ) -> Result<()>
runs the setter to assign the value for a register
fn register_type(&self) -> Option<RegisterType>
fn get_reversion_spec(&self) -> Option<Reversion>
fn get_expansion(&self) -> Option<&ExpansionBody>
fn stringify_type(&self, deftype: &str) -> String
Trait Implementations§
Source§impl Display for dyn Definition
impl Display for dyn Definition
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".