pub struct SymbolIndex { /* private fields */ }Expand description
Symbol keys grouped by symbol name, built by the caller.
A key is <file path>#<qualified symbol name> — everything before the
last # is taken as the defining file. resolve_call uses that to
prefer nearby definitions, so a caller that builds keys in some other
shape loses the same-file and same-directory tiers and falls back to
repo-wide uniqueness.
Implementations§
Source§impl SymbolIndex
impl SymbolIndex
pub fn new() -> Self
Sourcepub fn insert(&mut self, name: &str, key: &str)
pub fn insert(&mut self, name: &str, key: &str)
Record that name is defined by the symbol at key. Inserting the
same pair twice is a no-op, and the stored keys stay sorted, so the
index does not depend on insertion order.
A method — a name qualified Type.method — is filed twice: under the
name as written, and under the bare method. Source almost never
writes the qualified form. store.flush() says flush after the
receiver is stripped, and without the second entry no call on a
receiver could ever reach a method definition. The two sets are kept
apart because they carry different weight: see resolve_call, which
consults the bare entries only where the tier itself is evidence.