Skip to main content

Register

Struct Register 

Source
pub struct Register {
Show 14 fields pub cs: Token, pub address: String, pub parameters: Option<Parameters>, pub register_type: RegisterType, pub readonly: bool, pub value: Option<RegisterValue>, pub getter: Option<RegisterGetterClosure>, pub setter: Option<RegisterSetterClosure>, pub default: Option<RegisterValue>, pub mathglyph: Option<char>, pub role: Option<SymStr>, pub chardef_props: SymHashMap<Stored>, pub locator: Locator, pub origin: DefinitionOrigin, /* private fields */
}
Expand description

A struct representing a TeX register

Fields§

§cs: Token

the public command sequence for this register

§address: String

the internal address for this register. Set it before the register’s value is first read or assigned: address_sym caches it interned on first use.

§parameters: Option<Parameters>

associated parameters, if any

§register_type: RegisterType

the type of values accepted by this register (Number, Dimension, …)

§readonly: bool

read-only flag (default: false)

§value: Option<RegisterValue>

the current value

§getter: Option<RegisterGetterClosure>

reader for a value

§setter: Option<RegisterSetterClosure>

setter for a value

§default: Option<RegisterValue>

a default value

§mathglyph: Option<char>

the unicode corresponding to the \mathchar of value (for chardef)

§role: Option<SymStr>

role attribute for math chardef (e.g. “MULOP”, “BINOP”)

§chardef_props: SymHashMap<Stored>

additional properties for math chardefs (meaning, stretchy, scriptpos, mathstyle, etc.)

§locator: Locator

the source point of origin for this register definition

§origin: DefinitionOrigin

Implementations§

Source§

impl Register

Source

pub fn chardef_glyph(&self) -> Option<SymStr>

What a \chardef prints here: its math glyph, or its code’s glyph in the current font’s encoding (as invoke_primitive digests it); None for any other register.

Source

pub fn is_readonly(&self) -> bool

checks the readonly flag

Source

pub fn new_chardef( cs: Token, value: Option<RegisterValue>, mathglyph: Option<char>, role: Option<SymStr>, ) -> Self

A CharDef is a specialized register; You can’t assign it; when you invoke the control sequence, it returns the result of evaluating the character (more like a regular primitive). When mathglyph is provided, it is the unicode corresponding to the \mathchar of value

Source

pub fn new_math_chardef( cs: Token, value: Option<RegisterValue>, mathglyph: Option<char>, role: Option<SymStr>, props: CharDefProps, ) -> Self

A math CharDef is like a regular CharDef but stores additional decoded math properties (meaning, stretchy, scriptpos, mathstyle, chardef_name, etc.) Perl: LaTeXML::Core::Definition::CharDef->new($cs, ‘math’, $value)

Source

pub fn get_address(&self) -> Cow<'_, str>

Trait Implementations§

Source§

impl Clone for Register

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Register

Source§

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

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

impl Default for Register

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Definition for Register

Source§

fn is_register(&self) -> bool

Source§

fn is_prefix(&self) -> bool

Source§

fn is_readonly(&self) -> bool

Source§

fn invoke(&self, _once_only: bool) -> Result<Tokens>

Source§

fn get_parameters(&self) -> Option<&Parameters>

Source§

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
Source§

fn get_cs_name(&self) -> Cow<'_, str>

Source§

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

Source§

fn set_value( &self, value: RegisterValue, scope: Option<Scope>, args: Vec<ArgWrap>, ) -> Result<()>

runs the setter to assign the value for a register
Source§

fn invoke_primitive(&self) -> Result<Vec<Digested>>

Source§

fn before_digest(&self) -> Option<&Vec<BeforeDigestClosure>>

Source§

fn after_digest(&self) -> Option<&Vec<DigestionClosure>>

Source§

fn read_arguments(&self) -> Result<Vec<ArgWrap>>

Source§

fn do_absorption( &self, _document: &mut Document, _whatsit: &Whatsit, ) -> Result<Vec<Node>>

Source§

fn value_of(&self, args: Vec<ArgWrap>) -> Option<RegisterValue>

Source§

fn register_type(&self) -> Option<RegisterType>

Source§

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).
Source§

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.
Source§

fn get_cs_or_alias(&self) -> Cow<'_, Token>

Source§

fn get_sizer(&self) -> Option<SizingClosure>

Source§

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.
Source§

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).
Source§

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).
Source§

fn is_protected(&self) -> bool

Source§

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.
Source§

fn get_test(&self) -> Option<&ConditionalClosure>

Source§

fn get_conditional_type(&self) -> Option<ConditionalType>

Source§

fn invocation( &mut self, args: Vec<Option<Tokens>>, _gullet: &mut Gullet, ) -> Result<Tokens>

Source§

fn get_num_args(&self) -> usize

Source§

fn after_digest_body(&self) -> Option<&Vec<DigestionClosure>>

Source§

fn capture_body(&self) -> bool

Source§

fn execute_before_digest(&self) -> Result<Vec<Digested>>

Source§

fn execute_after_digest(&self, whatsit: &mut Whatsit) -> Result<Vec<Digested>>

Source§

fn execute_after_digest_body( &self, whatsit: &mut Whatsit, ) -> Result<Vec<Digested>>

Source§

fn get_reversion_spec(&self) -> Option<Reversion>

Source§

fn get_expansion(&self) -> Option<&ExpansionBody>

Source§

fn stringify_type(&self, deftype: &str) -> String

Source§

impl Display for Register

Source§

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

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

impl From<Register> for Stored

Source§

fn from(register: Register) -> Self

Converts to this type from the input type.
Source§

impl Object for Register

Source§

fn stringify(&self) -> String

Source§

fn isa_box(&self) -> bool

Source§

fn is_expandable(&self) -> bool

Source§

fn is_definition(&self) -> bool

Source§

fn is_comment(&self) -> bool

Source§

fn be_digested(self) -> Result<Digested>
where Self: Sized + Debug,

Source§

fn get_locator(&self) -> Option<Locator>

The object’s stored source locator, if it has one. None is the honest “no recorded source position” (replacing the old Locator::default() file!()/line!() sentinel). For “where the parser is now” (error reporting, box creation), use the free fn gullet::get_locator().
Source§

fn get_origin(&self) -> DefinitionOrigin

Who made this definition (K1 provenance, definition::origin). The default is Unknown, which counts as LaTeXML’s own.
Source§

fn revert(&self) -> Result<Tokens>

each concrete object needs to provide its own path back to tokens
Source§

impl PartialEq for Register

Source§

fn eq(&self, other: &Register) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.