pub struct Symbol {
pub id: SymId,
pub owner: Cell<HirId>,
pub name: String,
pub name_key: InternedStr,
pub fqn_name: RefCell<String>,
pub fqn_key: RefCell<InternedStr>,
pub depends: RefCell<Vec<SymId>>,
pub depended: RefCell<Vec<SymId>>,
pub kind: Cell<SymbolKind>,
pub unit_index: Cell<Option<usize>>,
pub block_id: Cell<Option<BlockId>>,
}Expand description
Canonical representation of an item bound in a scope (functions, variables, types, etc.).
Fields§
§id: SymIdMonotonic identifier assigned when the symbol is created.
owner: Cell<HirId>Owning HIR node that introduces the symbol (e.g. function, struct, module).
name: StringUnqualified name exactly as written in source.
name_key: InternedStrInterned key for name, used for fast lookup.
fqn_name: RefCell<String>Fully qualified name cached as a string (updated as scopes are resolved).
fqn_key: RefCell<InternedStr>Interned key for the fully qualified name.
depends: RefCell<Vec<SymId>>All symbols that this symbols depends on, most general relation, could be another relation, like field_of, type_of, called_by, calls etc. we dont do very clear sepration becase we want llm models to do that, we only need to tell models some symbols having depends relations
depended: RefCell<Vec<SymId>>§kind: Cell<SymbolKind>§unit_index: Cell<Option<usize>>Which compile unit this symbol defined
block_id: Cell<Option<BlockId>>Optional block id associated with this symbol (for graph building)
Implementations§
Source§impl Symbol
impl Symbol
pub fn new(owner: HirId, name: String, name_key: InternedStr) -> Self
pub fn owner(&self) -> HirId
pub fn set_owner(&self, owner: HirId)
pub fn format_compact(&self) -> String
pub fn set_fqn(&self, fqn: String, interner: &InternPool)
pub fn kind(&self) -> SymbolKind
pub fn set_kind(&self, kind: SymbolKind)
pub fn unit_index(&self) -> Option<usize>
pub fn set_unit_index(&self, file: usize)
pub fn add_depends_on(&self, sym_id: SymId)
pub fn add_depended_by(&self, sym_id: SymId)
pub fn add_dependency(&self, other: &Symbol)
pub fn block_id(&self) -> Option<BlockId>
pub fn set_block_id(&self, block_id: Option<BlockId>)
Trait Implementations§
Source§impl<'tcx> ArenaAllocatable<'tcx> for Symbol
impl<'tcx> ArenaAllocatable<'tcx> for Symbol
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx Self
Source§impl<'tcx> ArenaAllocatableMut<'tcx> for Symbol
impl<'tcx> ArenaAllocatableMut<'tcx> for Symbol
fn allocate_on_mut(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut Self
Auto Trait Implementations§
impl !Freeze for Symbol
impl !RefUnwindSafe for Symbol
impl Send for Symbol
impl !Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more