Skip to main content

ReferenceKind

Enum ReferenceKind 

Source
pub enum ReferenceKind {
    Variable(Arc<str>),
    MethodCall {
        class: Arc<str>,
        method: Arc<str>,
    },
    StaticCall {
        class: Arc<str>,
        method: Arc<str>,
    },
    PropertyAccess {
        class: Arc<str>,
        property: Arc<str>,
    },
    FunctionCall(Arc<str>),
    ClassReference(Arc<str>),
    ConstantAccess {
        class: Arc<str>,
        constant: Arc<str>,
    },
    GlobalConstant(Arc<str>),
    UseImport(Box<ReferenceKind>),
    Receiver,
}
Expand description

The kind of symbol reference that was resolved.

Variants§

§

Variable(Arc<str>)

A variable reference ($foo).

§

MethodCall

An instance method call ($obj->method()).

Fields

§class: Arc<str>
§method: Arc<str>
§

StaticCall

A static method call (Foo::method()).

Fields

§class: Arc<str>
§method: Arc<str>
§

PropertyAccess

A property access ($obj->prop).

Fields

§class: Arc<str>
§property: Arc<str>
§

FunctionCall(Arc<str>)

A free function call (foo()).

§

ClassReference(Arc<str>)

A class reference (new Foo, instanceof Foo, type hints).

§

ConstantAccess

A class constant access (Config::VERSION, self::CONST, parent::CONST).

Fields

§class: Arc<str>
§constant: Arc<str>
§

GlobalConstant(Arc<str>)

A global constant reference (FOO, \FOO).

§

UseImport(Box<ReferenceKind>)

A symbol occurrence inside a use import statement (use Foo\Bar;, use function foo\bar;, use const FOO\BAR;) — the import’s own name token, not a usage site. Kept distinct from the wrapped kind so a consumer walking reference-index postings (e.g. a future index-based rename) can tell an import line apart from a genuine usage: renaming must update the import too, but a plain find-references / dead-code “is this ever used” check must not count the bare import as one (there is deliberately no UnusedImport check).

§

Receiver

The type of a member-access receiver ($obj in $obj->prop, Foo in Foo::method()), recorded at the gap between the receiver expression and the member token — the ->/?->/:: operator and any intervening whitespace — rather than at the receiver’s own span. This is what lets a cursor sitting right after the operator (the position a member-completion request fires from) resolve a type, since that offset falls outside both the receiver expression’s span and the member’s span. Not a codebase-level symbol — to_name returns None.

Implementations§

Source§

impl ReferenceKind

Source

pub fn to_name(&self) -> Option<Name>

Map to a typed crate::Name, or None for kinds that don’t correspond to a codebase-level symbol (currently only Variable).

Trait Implementations§

Source§

impl Clone for ReferenceKind

Source§

fn clone(&self) -> ReferenceKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReferenceKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Lookup<T> for T

Source§

fn into_owned(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more