Enum ra_ap_ide_db::defs::NameClass [−][src]
pub enum NameClass {
Definition(Definition),
ConstReference(Definition),
PatFieldShorthand {
local_def: Local,
field_ref: Field,
},
}
Expand description
On a first blush, a single ast::Name
defines a single definition at some
scope. That is, that, by just looking at the syntactical category, we can
unambiguously define the semantic category.
Sadly, that’s not 100% true, there are special cases. To make sure that
callers handle all the special cases correctly via exhaustive matching, we
add a NameClass
enum which lists all of them!
A model special case is None
constant in pattern.
Variants
Definition(Definition)
Tuple Fields of Definition
0: Definition
ConstReference(Definition)
None
in if let None = Some(82) {}
.
Syntactically, it is a name, but semantically it is a reference.
Tuple Fields of ConstReference
0: Definition
field
in if let Foo { field } = foo
. Here, ast::Name
both introduces
a definition into a local scope, and refers to an existing definition.
Implementations
Definition
defined by this name.
pub fn classify_lifetime(
sema: &Semantics<'_, RootDatabase>,
lifetime: &Lifetime
) -> Option<NameClass>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for NameClass
impl UnwindSafe for NameClass
Blanket Implementations
Mutably borrows from an owned value. Read more
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more