pub struct Model { /* private fields */ }Expand description
A file’s regular entries, @string definitions, and @string uses.
Eq is load-bearing: the future bib_semantic_model salsa query will be not
no_eq (like semantic_model), so an edit leaving this model unchanged backdates
and downstream queries are not re-run.
Implementations§
Source§impl Model
impl Model
Sourcepub fn build(root: &SyntaxNode) -> Self
pub fn build(root: &SyntaxNode) -> Self
Build the model from a bib parse-tree root.
Sourcepub fn string_defs(&self) -> &[StringDef]
pub fn string_defs(&self) -> &[StringDef]
Every @string definition, in source order.
Sourcepub fn string_uses(&self) -> &[StringUse]
pub fn string_uses(&self) -> &[StringUse]
Every @string use, in source order.
Sourcepub fn duplicate_keys(&self) -> impl Iterator<Item = &Entry>
pub fn duplicate_keys(&self) -> impl Iterator<Item = &Entry>
Entries whose cite key duplicates an earlier one (the 2nd+ occurrence).
A per-file fact, not a lint signal: a duplicate-key diagnostic is built
on this by the linter (Phase 3), which decides severity and how to point at
each occurrence.
Sourcepub fn undefined_string_uses(&self) -> impl Iterator<Item = &StringUse>
pub fn undefined_string_uses(&self) -> impl Iterator<Item = &StringUse>
@string uses that match no in-file definition or predefined month macro.
A per-file fact, not a lint signal: in a multi-file bibliography the macro
may be defined elsewhere. The Phase-3 undefined-string lint would gate on a
cross-file resolution, mirroring undefined-ref.
Sourcepub fn unused_string_defs(&self) -> impl Iterator<Item = &StringDef>
pub fn unused_string_defs(&self) -> impl Iterator<Item = &StringDef>
@string definitions never referenced by any use in this file.
A per-file fact, not a lint signal on its own: in a multi-file
bibliography a @string defined here may be referenced from another .bib,
so the Phase-3 unused-string lint that builds on this carries a single-file
false-positive caveat until cross-file resolution gates it (Phase 4), exactly
as undefined_string_uses is gated. Both
name fields are lowercased, so the membership test is case-correct.