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 env_begin_alias(&self, name: &str) -> Option<&str>
pub fn env_begin_alias(&self, name: &str) -> Option<&str>
The environment name opens, if the per-file scan recorded it as an
environment alias (env_begin_aliases). The name
carries no leading \.
Sourcepub fn env_end_alias(&self, name: &str) -> Option<&str>
pub fn env_end_alias(&self, name: &str) -> Option<&str>
The closer mirror of env_begin_alias.
Sourcepub fn env_begin_aliases(&self) -> impl Iterator<Item = (&str, &str)>
pub fn env_begin_aliases(&self) -> impl Iterator<Item = (&str, &str)>
Every recorded opener alias, as (alias, target) pairs in arbitrary order.
Backs the parser’s projection of the map into its parse context.
Sourcepub fn env_end_aliases(&self) -> impl Iterator<Item = (&str, &str)>
pub fn env_end_aliases(&self) -> impl Iterator<Item = (&str, &str)>
The closer mirror of env_begin_aliases.
Sourcepub fn insert_env_begin_alias(
&mut self,
name: impl Into<SmolStr>,
target: impl Into<SmolStr>,
)
pub fn insert_env_begin_alias( &mut self, name: impl Into<SmolStr>, target: impl Into<SmolStr>, )
Record an opener alias, replacing any existing entry for name.
Sourcepub fn insert_env_end_alias(
&mut self,
name: impl Into<SmolStr>,
target: impl Into<SmolStr>,
)
pub fn insert_env_end_alias( &mut self, name: impl Into<SmolStr>, target: impl Into<SmolStr>, )
Record a closer alias, replacing any existing entry for name.
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 with Some(origin)) 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 insert_declared_environment(
&mut self,
name: impl Into<SmolStr>,
sig: EnvironmentSig,
)
pub fn insert_declared_environment( &mut self, name: impl Into<SmolStr>, sig: EnvironmentSig, )
Record an environment signature that came from a project declaration,
replacing any existing entry for name and marking its provenance. See
declared_environments for why the mark
exists.
Sourcepub fn is_declared_environment(&self, name: &str) -> bool
pub fn is_declared_environment(&self, name: &str) -> bool
Whether name’s signature came from a project declaration.
Sourcepub fn merge_from(&mut self, other: &SignatureDb, origin: Option<&str>)
pub fn merge_from(&mut self, other: &SignatureDb, origin: Option<&str>)
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.
When origin is Some, it replaces the provenance of every merged
signature. When it is None, each entry inherits other’s provenance,
clearing stale provenance when other has none.
Sourcepub fn merge_declarations(&mut self, declared: &ResolvedDeclarations)
pub fn merge_declarations(&mut self, declared: &ResolvedDeclarations)
Overlay a project’s resolved declarations as the top tier of this scope: a declaration is the user explicitly correcting an inference, so it wins over scanned definitions and loaded packages alike.
A named entry rather than merge_from(declared.as_db(), None) at each call
site, so the precedence rule is stated once and the two scope builders
(the CLI’s collect_package_signatures and the salsa scope_signatures)
cannot disagree about where in the order it goes.
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