pub enum Definition {
Show 24 variants
Macro(Macro),
Field(Field),
TupleField(TupleField),
Module(Module),
Function(Function),
Adt(Adt),
Variant(Variant),
Const(Const),
Static(Static),
Trait(Trait),
TraitAlias(TraitAlias),
TypeAlias(TypeAlias),
SelfType(Impl),
GenericParam(GenericParam),
Local(Local),
Label(Label),
DeriveHelper(DeriveHelper),
BuiltinType(BuiltinType),
BuiltinLifetime(StaticLifetime),
BuiltinAttr(BuiltinAttr),
ToolModule(ToolModule),
ExternCrateDecl(ExternCrateDecl),
InlineAsmRegOrRegClass(()),
InlineAsmOperand(InlineAsmOperand),
}
Variants§
Macro(Macro)
Field(Field)
TupleField(TupleField)
Module(Module)
Function(Function)
Adt(Adt)
Variant(Variant)
Const(Const)
Static(Static)
Trait(Trait)
TraitAlias(TraitAlias)
TypeAlias(TypeAlias)
SelfType(Impl)
GenericParam(GenericParam)
Local(Local)
Label(Label)
DeriveHelper(DeriveHelper)
BuiltinType(BuiltinType)
BuiltinLifetime(StaticLifetime)
BuiltinAttr(BuiltinAttr)
ToolModule(ToolModule)
ExternCrateDecl(ExternCrateDecl)
InlineAsmRegOrRegClass(())
InlineAsmOperand(InlineAsmOperand)
Implementations§
source§impl Definition
impl Definition
pub fn canonical_module_path( &self, db: &RootDatabase, ) -> Option<impl Iterator<Item = Module>>
pub fn krate(&self, db: &RootDatabase) -> Option<Crate>
pub fn module(&self, db: &RootDatabase) -> Option<Module>
pub fn enclosing_definition(&self, db: &RootDatabase) -> Option<Definition>
pub fn visibility(&self, db: &RootDatabase) -> Option<Visibility>
pub fn name(&self, db: &RootDatabase) -> Option<Name>
pub fn docs( &self, db: &RootDatabase, famous_defs: Option<&FamousDefs<'_, '_>>, edition: Edition, ) -> Option<Documentation>
pub fn label(&self, db: &RootDatabase, edition: Edition) -> String
source§impl Definition
impl Definition
pub fn rename( &self, sema: &Semantics<'_, RootDatabase>, new_name: &str, ) -> Result<SourceChange>
sourcepub fn range_for_rename(
self,
sema: &Semantics<'_, RootDatabase>,
) -> Option<FileRange>
pub fn range_for_rename( self, sema: &Semantics<'_, RootDatabase>, ) -> Option<FileRange>
Textual range of the identifier which will change when renaming this
Definition
. Note that builtin types can’t be
renamed and extern crate names will report its range, though a rename will introduce
an alias instead.
source§impl Definition
impl Definition
pub fn usages<'a>(self, sema: &'a Semantics<'_, RootDatabase>) -> FindUsages<'a>
Trait Implementations§
source§impl AsAssocItem for Definition
impl AsAssocItem for Definition
fn as_assoc_item(self, db: &dyn HirDatabase) -> Option<AssocItem>
source§impl AsExternAssocItem for Definition
impl AsExternAssocItem for Definition
fn as_extern_assoc_item(self, db: &dyn HirDatabase) -> Option<ExternAssocItem>
source§impl Clone for Definition
impl Clone for Definition
source§fn clone(&self) -> Definition
fn clone(&self) -> Definition
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Definition
impl Debug for Definition
source§impl From<Adt> for Definition
impl From<Adt> for Definition
source§fn from(it: Adt) -> Definition
fn from(it: Adt) -> Definition
Converts to this type from the input type.
source§impl From<AssocItem> for Definition
impl From<AssocItem> for Definition
source§impl From<BuiltinType> for Definition
impl From<BuiltinType> for Definition
source§fn from(it: BuiltinType) -> Definition
fn from(it: BuiltinType) -> Definition
Converts to this type from the input type.
source§impl From<Const> for Definition
impl From<Const> for Definition
source§fn from(it: Const) -> Definition
fn from(it: Const) -> Definition
Converts to this type from the input type.
source§impl From<DocLinkDef> for Definition
impl From<DocLinkDef> for Definition
source§fn from(def: DocLinkDef) -> Self
fn from(def: DocLinkDef) -> Self
Converts to this type from the input type.
source§impl From<Either<PathResolution, InlineAsmOperand>> for Definition
impl From<Either<PathResolution, InlineAsmOperand>> for Definition
source§fn from(value: Either<PathResolution, InlineAsmOperand>) -> Self
fn from(value: Either<PathResolution, InlineAsmOperand>) -> Self
Converts to this type from the input type.
source§impl From<ExternCrateDecl> for Definition
impl From<ExternCrateDecl> for Definition
source§fn from(it: ExternCrateDecl) -> Definition
fn from(it: ExternCrateDecl) -> Definition
Converts to this type from the input type.
source§impl From<Field> for Definition
impl From<Field> for Definition
source§fn from(it: Field) -> Definition
fn from(it: Field) -> Definition
Converts to this type from the input type.
source§impl From<Function> for Definition
impl From<Function> for Definition
source§fn from(it: Function) -> Definition
fn from(it: Function) -> Definition
Converts to this type from the input type.
source§impl From<GenericParam> for Definition
impl From<GenericParam> for Definition
source§fn from(it: GenericParam) -> Definition
fn from(it: GenericParam) -> Definition
Converts to this type from the input type.
source§impl From<Impl> for Definition
impl From<Impl> for Definition
source§impl From<InlineAsmOperand> for Definition
impl From<InlineAsmOperand> for Definition
source§fn from(value: InlineAsmOperand) -> Self
fn from(value: InlineAsmOperand) -> Self
Converts to this type from the input type.
source§impl From<Label> for Definition
impl From<Label> for Definition
source§fn from(it: Label) -> Definition
fn from(it: Label) -> Definition
Converts to this type from the input type.
source§impl From<Local> for Definition
impl From<Local> for Definition
source§fn from(it: Local) -> Definition
fn from(it: Local) -> Definition
Converts to this type from the input type.
source§impl From<Macro> for Definition
impl From<Macro> for Definition
source§fn from(it: Macro) -> Definition
fn from(it: Macro) -> Definition
Converts to this type from the input type.
source§impl From<Module> for Definition
impl From<Module> for Definition
source§fn from(it: Module) -> Definition
fn from(it: Module) -> Definition
Converts to this type from the input type.
source§impl From<ModuleDef> for Definition
impl From<ModuleDef> for Definition
source§impl From<PathResolution> for Definition
impl From<PathResolution> for Definition
source§fn from(path_resolution: PathResolution) -> Self
fn from(path_resolution: PathResolution) -> Self
Converts to this type from the input type.
source§impl From<Static> for Definition
impl From<Static> for Definition
source§fn from(it: Static) -> Definition
fn from(it: Static) -> Definition
Converts to this type from the input type.
source§impl From<Trait> for Definition
impl From<Trait> for Definition
source§fn from(it: Trait) -> Definition
fn from(it: Trait) -> Definition
Converts to this type from the input type.
source§impl From<TraitAlias> for Definition
impl From<TraitAlias> for Definition
source§fn from(it: TraitAlias) -> Definition
fn from(it: TraitAlias) -> Definition
Converts to this type from the input type.
source§impl From<TypeAlias> for Definition
impl From<TypeAlias> for Definition
source§fn from(it: TypeAlias) -> Definition
fn from(it: TypeAlias) -> Definition
Converts to this type from the input type.
source§impl From<Variant> for Definition
impl From<Variant> for Definition
source§fn from(it: Variant) -> Definition
fn from(it: Variant) -> Definition
Converts to this type from the input type.
source§impl From<VariantDef> for Definition
impl From<VariantDef> for Definition
source§fn from(def: VariantDef) -> Self
fn from(def: VariantDef) -> Self
Converts to this type from the input type.
source§impl Hash for Definition
impl Hash for Definition
source§impl PartialEq for Definition
impl PartialEq for Definition
source§impl TryFrom<DefWithBody> for Definition
impl TryFrom<DefWithBody> for Definition
impl Copy for Definition
impl Eq 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 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
§impl<T> Cast for T
impl<T> Cast for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
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 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> ⓘ
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