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 semantic_digest: ContentHash,
}Expand description
The per-file semantic node: the symbols a source blob defines plus the reformat-stable digest over them.
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 (container_path, name, kind, span.0).
semantic_digest: ContentHashReformat-stable digest — see compute_file_semantic_digest.
Implementations§
Source§impl SemanticFileNode
impl SemanticFileNode
pub const FORMAT_VERSION: u8 = 1
Sourcepub fn new(
language: impl Into<String>,
grammar_version: impl Into<String>,
extractor_version: u32,
source_blob: ContentHash,
scaffold_hash: ContentHash,
symbols: Vec<SymbolEntry>,
) -> Self
pub fn new( language: impl Into<String>, grammar_version: impl Into<String>, extractor_version: u32, source_blob: ContentHash, scaffold_hash: ContentHash, symbols: Vec<SymbolEntry>, ) -> 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
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SemanticFileNode
impl Debug for SemanticFileNode
Source§impl<'de> Deserialize<'de> for SemanticFileNode
impl<'de> Deserialize<'de> for SemanticFileNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SemanticFileNode
Source§impl PartialEq for SemanticFileNode
impl PartialEq for SemanticFileNode
Source§impl Serialize for SemanticFileNode
impl Serialize for SemanticFileNode
impl StructuralPartialEq for SemanticFileNode
Auto Trait Implementations§
impl Freeze for SemanticFileNode
impl RefUnwindSafe for SemanticFileNode
impl Send for SemanticFileNode
impl Sync for SemanticFileNode
impl Unpin for SemanticFileNode
impl UnsafeUnpin for SemanticFileNode
impl UnwindSafe for SemanticFileNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more