pub struct SemanticFileNode {
pub format_version: u8,
pub language: String,
pub grammar_version: String,
pub extractor_version: u32,
pub source_blob: ContentHash,
pub scaffold_hash: ContentHash,
pub symbols: Vec<SymbolEntry>,
pub scopes: Vec<ScopeEntry>,
pub imports: Vec<ImportEntry>,
pub occurrences: Vec<OccurrenceEntry>,
pub semantic_digest: ContentHash,
}Expand description
The per-file semantic node: deterministic source-local facts extracted from one source blob plus their reformat-stable digest.
Fields§
§format_version: u8§language: String§grammar_version: String§extractor_version: u32§source_blob: ContentHashContent hash of the raw source blob this node was extracted from.
scaffold_hash: ContentHashHash of the file’s residual non-definition token stream — see
compute_file_scaffold_hash. Binds semantic content that lives outside
any extracted symbol into the file digest.
symbols: Vec<SymbolEntry>Symbols sorted by the span-free semantic key.
scopes: Vec<ScopeEntry>Scopes sorted by deterministic preorder local_id.
imports: Vec<ImportEntry>Imports sorted by their span-free semantic key; bindings retain source order.
occurrences: Vec<OccurrenceEntry>Occurrences sorted by deterministic source-order local_id.
semantic_digest: ContentHashReformat-stable digest — see compute_file_semantic_digest.
Implementations§
Source§impl SemanticFileNode
impl SemanticFileNode
pub const FORMAT_VERSION: u8 = 2
Sourcepub fn new(
language: impl Into<String>,
grammar_version: impl Into<String>,
extractor_version: u32,
source_blob: ContentHash,
scaffold_hash: ContentHash,
facts: SemanticFileFacts,
) -> Self
pub fn new( language: impl Into<String>, grammar_version: impl Into<String>, extractor_version: u32, source_blob: ContentHash, scaffold_hash: ContentHash, facts: SemanticFileFacts, ) -> Self
Build a node, sorting the symbols canonically and computing the digest over the scaffold plus the symbols.
pub fn encode(&self) -> Result<Vec<u8>, SemanticIndexError>
pub fn decode(bytes: &[u8]) -> Result<Self, SemanticIndexError>
Sourcepub fn symbol_by_address(&self, address: &str) -> Option<&SymbolEntry>
pub fn symbol_by_address(&self, address: &str) -> Option<&SymbolEntry>
Find a symbol by its canonical address (container::name).
Trait Implementations§
Source§impl Clone for SemanticFileNode
impl Clone for SemanticFileNode
Source§fn clone(&self) -> SemanticFileNode
fn clone(&self) -> SemanticFileNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more