pub struct SignatureDb { /* private fields */ }Expand description
The built-in command and environment signatures, keyed by name (without the
leading \ for commands, the bare name for environments). Case-sensitive, as
LaTeX names are (Verbatim ≠ verbatim).
Implementations§
Source§impl SignatureDb
impl SignatureDb
Sourcepub fn command(&self, name: &str) -> Option<&CommandSig>
pub fn command(&self, name: &str) -> Option<&CommandSig>
The signature of command name (without the leading \), if known.
Sourcepub fn environment(&self, name: &str) -> Option<&EnvironmentSig>
pub fn environment(&self, name: &str) -> Option<&EnvironmentSig>
The signature of environment name, if known.
Sourcepub fn command_names(&self) -> impl Iterator<Item = &str>
pub fn command_names(&self) -> impl Iterator<Item = &str>
All known command names (without the leading \), in arbitrary order.
Backs name completion, which unions these with the per-document scanned
definitions; the lookup methods stay the only refinement path.
Sourcepub fn environment_names(&self) -> impl Iterator<Item = &str>
pub fn environment_names(&self) -> impl Iterator<Item = &str>
All known environment names, in arbitrary order. See command_names.
Sourcepub fn command_origin(&self, name: &str) -> Option<&str>
pub fn command_origin(&self, name: &str) -> Option<&str>
The package (file stem) whose merge supplied the current signature of
command name, if it came from a package
(merge_from_package) rather than the
document or a static tier.
Sourcepub fn environment_origin(&self, name: &str) -> Option<&str>
pub fn environment_origin(&self, name: &str) -> Option<&str>
The environment mirror of command_origin.
Sourcepub fn insert_command(&mut self, name: impl Into<SmolStr>, sig: CommandSig)
pub fn insert_command(&mut self, name: impl Into<SmolStr>, sig: CommandSig)
Record a command signature, replacing any existing entry for name. Used
by the per-file definition scan (super::define) to populate a fresh DB;
the built-in DB is built from JSON and never mutated. A redefinition wins,
mirroring TeX’s last-\newcommand-wins behavior; any recorded package
origin is cleared, since it described the entry being replaced.
Sourcepub fn insert_environment(
&mut self,
name: impl Into<SmolStr>,
sig: EnvironmentSig,
)
pub fn insert_environment( &mut self, name: impl Into<SmolStr>, sig: EnvironmentSig, )
Record an environment signature, replacing any existing entry for name.
Sourcepub fn merge_from(&mut self, other: &SignatureDb)
pub fn merge_from(&mut self, other: &SignatureDb)
Merge every command and environment of other into self, with other
winning on a name clash (last-definition-wins, like an individual
insert_*). Used to fold a loaded package’s scanned definitions into a
document’s merged signature scope; the caller orders the merges so the
document’s own definitions are applied last and override any package.
Origins always describe the current entry: each merged name takes
other’s origin when it has one, and clears any stale one of self’s
otherwise — so the document overlay (scanned defs carry no origins)
automatically strips package provenance from a shadowed name.
Sourcepub fn merge_from_package(&mut self, other: &SignatureDb, origin: &str)
pub fn merge_from_package(&mut self, other: &SignatureDb, origin: &str)
Like merge_from, additionally recording origin
(a package file stem, e.g. mypkg) as the provenance of every merged
name. Used when folding a loaded package’s scanned definitions into a
document scope, so hover can name the defining package.
Package-over-package: the last merge wins, consistent with the
signature overwrite itself.
Trait Implementations§
Source§impl Clone for SignatureDb
impl Clone for SignatureDb
Source§fn clone(&self) -> SignatureDb
fn clone(&self) -> SignatureDb
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more