pub struct State {Show 39 fields
pub tag_properties: FxHashMap<SymStr, TagOptions>,
pub indirect_model: Option<IndirectModel>,
pub pending_resources: Vec<Resource>,
pub verbosity: i32,
pub input_encoding: Option<String>,
pub search_paths: VecDeque<String>,
pub graphics_paths: VecDeque<String>,
pub nomathparse: bool,
pub if_count: i64,
pub if_stack: Vec<Rc<RefCell<IfFrame>>>,
pub if_limit: i64,
pub absorb_count: i64,
pub absorb_limit: i64,
pub source_map: bool,
pub source_table: Vec<SymStr>,
pub opened_sources: FxHashSet<SymStr>,
pub bindings_dispatch: Option<ResolvingBindingDispatcher>,
pub extra_bindings_dispatch: Option<BindingDispatcher>,
pub local_binding_finder: Option<LocalBindingFinder>,
pub binding_names: Vec<&'static [(&'static str, &'static str)]>,
pub label_mapping_hook: Option<LabelMappingHook>,
pub fallback_meanings: FxHashMap<SymStr, DefinitionOrigin>,
pub provide_only_assigned: FxHashSet<SymStr>,
pub provide_only_loaded: Vec<String>,
pub borrowed_loaded: Vec<String>,
pub copy_provides_copies: Vec<CopyProvidesRecord>,
pub copy_provides_frames: Vec<CopyProvidesFrame>,
pub stand_in_meanings: FxHashSet<SymStr>,
pub stand_in_base_defaults: FxHashSet<SymStr>,
pub stand_in_loads: Vec<Vec<SymStr>>,
pub stand_in_last_load: Vec<SymStr>,
pub stand_in_load_files: Vec<Vec<String>>,
pub stand_in_last_files: Vec<String>,
pub binding_lets: FxHashSet<SymStr>,
pub refused_names: FxHashSet<SymStr>,
pub watched_setters: FxHashSet<SymStr>,
pub class_loads: Vec<ClassLoadRecord>,
pub class_load_frames: Vec<usize>,
pub copy_class_loads: Vec<(u32, Vec<String>)>,
/* private fields */
}Expand description
The state efficiently bookkeeps the bindings in a TeX-like fashion.
Bindings associate data with keys (eg definitions with macro names) and respect TeX grouping; that is, an assignment is only in effect until the current group (opened by \bgroup) is closed (by \egroup).
Fields§
§tag_properties: FxHashMap<SymStr, TagOptions>§indirect_model: Option<IndirectModel>an optional indirect model for long-distance relationships
pending_resources: Vec<Resource>Document-related resources declared during core conversion, pending until XML is finalized
verbosity: i32§input_encoding: Option<String>§search_paths: VecDeque<String>Seed only for the group-scoped SEARCHPATHS value-table list (read once at
construction to seed it); live lookups go through get_search_paths.
graphics_paths: VecDeque<String>Seed only for the group-scoped GRAPHICSPATHS value-table list (read once at
construction to seed it); live lookups go through get_graphics_paths.
nomathparse: boolflag to disable math parsing
if_count: i64Perl Conditional.pm:61-62: the if_count Value entry, assigned
'global' on every \if… so the per-conditional id survives group
exit. A value only ever assigned globally collapses to one base-frame
binding, so a plain monotonic field is the same counter without the
per-conditional assign_internal(Global) undo-frame walk (measured
4.4 % of instructions on \ifnum-dense pgf input). Runtime-only, so
it never enters a dump. Micro-divergence: \globaldefs<0 demoted
Perl’s assignment to local (ids could repeat after a group); the id is
the IfFrame’s diagnostic tag, never a matching key, so it is unaffected.
if_stack: Vec<Rc<RefCell<IfFrame>>>Perl Conditional.pm:63 unshiftValue('if_stack', $ifframe): the active conditionals,
innermost last. Perl edits the Value in place (unshiftValue/shiftValue, never grouped
or undone), so a typed field is the same stack without the per-\if/\else/\fi
value-table lookups. Runtime-only, so it never enters a dump.
if_limit: i64Perl $LaTeXML::IF_LIMIT (latexml.sty.ltxml:101): a plain global,
never a State value. 0 = unlimited.
absorb_count: i64Perl Object.pm:165 / Box.pm:145: the absorb_count Value, assigned
'global' per absorbed box — the same mechanism as Self::if_count
(a Perl global-only Value becomes a typed State scalar).
absorb_limit: i64Perl $LaTeXML::ABSORB_LIMIT (latexml.sty.ltxml:104), 0 = unlimited.
source_map: boolflag enabling source-locator (--source-map) tracking + emission.
Off by default; gates BOTH the per-token start capture and the
per-element data-sourcepos stamping so a normal conversion pays
nothing. See docs/performance/SOURCE_PROVENANCE.md.
source_table: Vec<SymStr>Document-level sources table for the source-map feature: ordered
list of source files seen, index = the integer tag emitted in
data-sourcepos (Source-Map-v3 sources style — never an inlined
path). Populated lazily via source_tag() only when source_map is
on. See docs/performance/SOURCE_PROVENANCE.md §0.1.
opened_sources: FxHashSet<SymStr>Read-log of every named source opened through Mouth::create
(file paths and cached-content names; literal/anonymous mouths are
not named, so not recorded). Distinct from source_table, which
is populated lazily at document-construction time and filters to
user sources — this log is complete and available right after a
digest, which the LSP server’s warm-cache dependency snapshot
relies on (lsp_server/overlay.rs::warmup_dep_snapshot).
bindings_dispatch: Option<ResolvingBindingDispatcher>The installed binding-resolution chain — reports the source path it loaded
from (for a .rhai file binding), or None for a compiled-in binding.
extra_bindings_dispatch: Option<BindingDispatcher>Auxiliary convenience – extra dispatch
local_binding_finder: Option<LocalBindingFinder>The chain’s first tier, a user’s binding file in the local search paths (local_binding_file).
binding_names: Vec<&'static [(&'static str, &'static str)]>All (name, ext) pairs for compile-time bindings the dispatchers can
load, stacked one slice per registered dispatcher. Populated at
startup by each binding crate via add_binding_names, so both
latexml_package and latexml_contrib contribute their classes/
styles/defs/pools to the fallback pool. Consumed by:
find_file(notex=true)to resolve compile-time bindings without touching the filesystem.load_class’s Perl-parity prefix-match fallback (Package.pm L2702-2706) via theget_class_binding_names()filtered view.
label_mapping_hook: Option<LabelMappingHook>Perl: LABEL_MAPPING_HOOK — closure mapping (label, counter, norefnum) -> (refnum, id)
fallback_meanings: FxHashMap<SymStr, DefinitionOrigin>The names whose current meaning a fallback class installed (DefinitionOrigin::Fallback, OmniBus), a kernel stub
or a borrow, with that origin, until something else assigns them: a document’s \newcommand may define them
(is_fallback_meaning, fallback_meaning_origin).
provide_only_assigned: FxHashSet<SymStr>The names assigned while a provide-only load lives (ProvideOnlyGuard):
the load’s own definitions, which it may define again (provide_only_declines).
provide_only_loaded: Vec<String>The files first marked loaded while a provide-only load lives: loaded partly (their definitions of names defined
before were declined), so the guard unmarks them when it ends and a later request loads them whole
(end_provide_only).
borrowed_loaded: Vec<String>The files first marked loaded while a binding borrows a package (DefinitionOrigin::Borrowed,
binding::content::require_package_borrowed): the borrowed package and what it loads (amsthm’s amsgen), which the
borrow unmarks again, as LaTeX never loaded them.
copy_provides_copies: Vec<CopyProvidesRecord>The paper’s copies of author files read after their stand-in bindings, by number less one
(crate::definition::origin::copy_provides; note_copy_provides_assignment).
copy_provides_frames: Vec<CopyProvidesFrame>The frames of the stand-in copies’ provides-mode in force, innermost last
(enter_copy_provides_frame).
stand_in_meanings: FxHashSet<SymStr>The names assigned while a stand-in binding loaded (crate::definition::origin::StandInLoadGuard): its own, which
the paper’s copy read after it only provides (note_copy_provides_assignment).
stand_in_base_defaults: FxHashSet<SymStr>The names whose meaning a class the stand-in binding loads assigned last
(crate::definition::origin::stand_in_base_class): its base class’s, whose text defaults are not the binding’s
(unowned_text_default).
stand_in_loads: Vec<Vec<SymStr>>The names each stand-in binding loading now has assigned in its own code, innermost last (begin_stand_in_load).
stand_in_last_load: Vec<SymStr>The names the stand-in binding loaded last assigned in its own code (end_stand_in_load): the public ones are
the command set the paper’s copy must define to be that binding’s file (binding::content read_stand_in_copy).
stand_in_load_files: Vec<Vec<String>>The files each stand-in binding loading now loads from its own code (its LoadClass!/RequirePackage!), or
whose binding’s definitions it makes as code, innermost last (note_stand_in_file).
stand_in_last_files: Vec<String>The files the stand-in binding loaded last loaded from its own code (end_stand_in_load): the files it is
built on, which the paper’s copy may declare itself (binding::content copy_is_the_stood_in_file).
binding_lets: FxHashSet<SymStr>The names LaTeXML’s own code (Unknown, Pool, Binding origins) \let, recorded as it makes them
(let_i): a \let copies another name’s definition, so the name a binding gave it is no longer on the object
(owned_by_the_semantic_layer; aas_support_sty.rs’s \let\subjectheadings\keywords).
refused_names: FxHashSet<SymStr>The names a lock’s refusal record was written for (note_redefined, carry_refusal_records): a
document’s \let reads the records only of these.
watched_setters: FxHashSet<SymStr>The frontmatter setters whose calls are observed (crate::definition::origin::watch_setter_calls).
class_loads: Vec<ClassLoadRecord>Each class loaded, with the names its load frame assigned and the classes loaded inside it: what that class
defines, as its real file does (ClassLoadFrame, copy_base_class_defines, class_layer_definition).
class_load_frames: Vec<usize>The class loads open now, as indices into State::class_loads, innermost last (ClassLoadFrame).
copy_class_loads: Vec<(u32, Vec<String>)>The stand-in copies whose own \LoadClass is open now, innermost last, each with the classes the class load
open when it began had loaded: a class loaded inside it is a base class of that copy too (ClassLoadFrame; the
reviewer’s probe nc_chain, \LoadClass{mybase} over article), and a copy’s first entry holds the classes its
binding’s load loaded (open_class_load_classes).
Implementations§
Source§impl State
impl State
pub fn new(options: StateOptions) -> Self
Sourcepub fn snapshot(&self) -> FxHashMap<(TableName, SymStr), Stored>
pub fn snapshot(&self) -> FxHashMap<(TableName, SymStr), Stored>
Perl DumpFile equivalent: Take a snapshot of the current state. Returns a HashMap mapping (table_name, key) → Stored value. Only captures the front (current) value of each key. Used before processing latex.ltx to diff what changed.
Sourcepub fn diff_from_snapshot(
&self,
snap: &FxHashMap<(TableName, SymStr), Stored>,
) -> Vec<(TableName, SymStr, Stored)>
pub fn diff_from_snapshot( &self, snap: &FxHashMap<(TableName, SymStr), Stored>, ) -> Vec<(TableName, SymStr, Stored)>
Perl DumpFile equivalent: Compute the diff between current state and a snapshot. Returns only entries that CHANGED since the snapshot was taken. Skips entries that contain closures (Primitive, Constructor, Conditional) since those can’t be serialized — they come from Rust engine code.
Sourcepub fn get_prefix(&self, prefix: &str) -> bool
pub fn get_prefix(&self, prefix: &str) -> bool
gets the current value of a named prefix
Sourcepub fn get_prefix_sym(&self, prefix: SymStr) -> bool
pub fn get_prefix_sym(&self, prefix: SymStr) -> bool
get_prefix variant with a pre-pinned SymStr (see crate::pin!) —
assign_internal probes the global prefix on every unscoped
assignment, so the per-call arena::pin there was pure overhead.
Sourcepub fn assign_value<T: Into<Stored>, S: Into<Option<Scope>>>(
&mut self,
key: &str,
value: T,
scope: S,
)
pub fn assign_value<T: Into<Stored>, S: Into<Option<Scope>>>( &mut self, key: &str, value: T, scope: S, )
assigns a Stored value at the given key and scope
Sourcepub fn lookup_value(&self, key: &str) -> Option<&Stored>
pub fn lookup_value(&self, key: &str) -> Option<&Stored>
fetches a Stored value at the given key, from the Value table
pub fn lookup_value_sym(&self, key: SymStr) -> Option<&Stored>
Sourcepub fn lookup_value_mut(&mut self, key: &str) -> Option<&mut Stored>
pub fn lookup_value_mut(&mut self, key: &str) -> Option<&mut Stored>
mutably borrows a Stored value at the given key, from the Value table
Sourcepub fn lookup_vecdeque(&self, key: &str) -> Option<&VecDeque<Stored>>
pub fn lookup_vecdeque(&self, key: &str) -> Option<&VecDeque<Stored>>
like lookup_value but only recognizes Stored::VecDequeStored
pub fn lookup_font_info(&self, key: &Token) -> Result<Option<&Stored>>
Sourcepub fn lookup_mapping(&self, map: &str, key: &str) -> Option<&Stored>
pub fn lookup_mapping(&self, map: &str, key: &str) -> Option<&Stored>
manage a (global) hash of values