pub struct Symbol {Show 15 fields
pub id: SymbolId,
pub name: String,
pub kind: SymbolKind,
pub visibility: Visibility,
pub file: SourcePath,
pub span: Span,
pub sig_hash: Fingerprint,
pub body_hash: Fingerprint,
pub parent: Option<SymbolId>,
pub signature: Option<String>,
pub doc: Option<String>,
pub generics: Vec<String>,
pub tags: Vec<String>,
pub members: Vec<Member>,
pub flow: Option<Flow>,
}Expand description
A named definition in the codebase.
Fields§
§id: SymbolIdCanonical id.
name: StringShort name.
kind: SymbolKindKind of definition.
visibility: VisibilityVisibility.
file: SourcePathFile the definition lives in.
span: SpanWhere in the file.
sig_hash: FingerprintFingerprint of the symbol’s contract (name, visibility, attributes,
generics, parameters, return type; see sealmap-extract’s
fingerprint module for the per-kind rules). Whitespace, comments and
position never affect it.
body_hash: FingerprintFingerprint of the symbol’s implementation (its body). Excludes the name, so a renamed symbol keeps it.
parent: Option<SymbolId>Enclosing symbol (the type for a method, the module for an item).
signature: Option<String>One-line signature, e.g. pub fn connect(&self, addr: &str) -> Result<Conn>.
doc: Option<String>First sentence of the doc comment, if any. Kept short on purpose: it is context for an agent, not a copy of the docs.
generics: Vec<String>Generic parameters as written (T: Clone, 'a, const N: usize).
Notable attributes / modifiers: derives (derive(Debug)), async,
unsafe, const, test, cfg(...), trait name for trait impls, etc.
members: Vec<Member>Fields, variants and associated items.
flow: Option<Flow>Ordered control/call flow of the body, for callables.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn new(
id: SymbolId,
name: impl Into<String>,
kind: SymbolKind,
file: SourcePath,
) -> Self
pub fn new( id: SymbolId, name: impl Into<String>, kind: SymbolKind, file: SourcePath, ) -> Self
A symbol with only the required fields set; everything else empty /
private, and both fingerprints unset (Fingerprint::is_unset).
Language adapters fill in the rest.
Source§impl Symbol
impl Symbol
Sourcepub fn is_unparsable(&self) -> bool
pub fn is_unparsable(&self) -> bool
true when this is the module symbol of a file that failed to parse
(it carries PARSE_ERROR_TAG).