pub struct Definition {
pub target: Target,
pub name: Name,
pub kind: SymbolKind,
pub location: Option<Location>,
pub range: Option<Location>,
pub parent: Option<DefRef>,
}Expand description
One definition.
§Examples
use hir_lang::{Builder, Name};
use intern_lang::Interner;
use resolve_lang::SymbolKind;
let mut names = Interner::new();
let mut b = Builder::new();
let body = b.block(&[], None);
let f = b.func(Name::new(names.intern("f")), &[], body);
let root = b.module(None, &[f]);
let res = resolve_lang::resolve(b.finish(root)?, &names)?;
let def = res.index().definitions().iter().find(|d| d.kind == SymbolKind::Function).unwrap();
assert_eq!(names.resolve(def.name.sym), Some("f"));Fields§
§target: TargetWhat it is.
name: NameIts name.
kind: SymbolKindIts kind.
location: Option<Location>Where its name is: None for something outside the program, and for
an item whose lowering recorded no name span (use range then).
range: Option<Location>The span of the whole definition (an item’s or binder’s own span).
parent: Option<DefRef>The enclosing item’s definition, for symbol trees.
Trait Implementations§
Source§impl Clone for Definition
impl Clone for Definition
impl Copy for Definition
Source§impl Debug for Definition
impl Debug for Definition
impl Eq for Definition
Source§impl PartialEq for Definition
impl PartialEq for Definition
impl StructuralPartialEq for Definition
Auto Trait Implementations§
impl Freeze for Definition
impl RefUnwindSafe for Definition
impl Send for Definition
impl Sync for Definition
impl Unpin for Definition
impl UnsafeUnpin for Definition
impl UnwindSafe for Definition
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