Enum ra_ap_ide_db::defs::NameClass
source · [−]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)
ConstReference(Definition)
None
in if let None = Some(82) {}
.
Syntactically, it is a name, but semantically it is a reference.
PatFieldShorthand
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
sourceimpl NameClass
impl NameClass
sourcepub fn defined(self) -> Option<Definition>
pub fn defined(self) -> Option<Definition>
Definition
defined by this name.
pub fn classify(
sema: &Semantics<'_, RootDatabase>,
name: &Name
) -> Option<NameClass>
pub fn classify_lifetime(
sema: &Semantics<'_, RootDatabase>,
lifetime: &Lifetime
) -> Option<NameClass>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for NameClass
impl Send for NameClass
impl Sync for NameClass
impl Unpin for NameClass
impl UnwindSafe for NameClass
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Cast for T
impl<T> Cast for T
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
.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more