pub struct State {Show 15 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 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 binding_names: Vec<&'static [(&'static str, &'static str)]>,
pub label_mapping_hook: Option<LabelMappingHook>,
/* 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
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
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)
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