pub struct ImportAssets<'db> { /* private fields */ }
Expand description
A struct to find imports in the project, given a certain name (or its part) and the context.
Implementations§
Source§impl<'db> ImportAssets<'db>
impl<'db> ImportAssets<'db>
pub fn for_method_call( method_call: &MethodCallExpr, sema: &Semantics<'db, RootDatabase>, ) -> Option<Self>
pub fn for_exact_path( fully_qualified_path: &Path, sema: &Semantics<'db, RootDatabase>, ) -> Option<Self>
pub fn for_ident_pat( sema: &Semantics<'db, RootDatabase>, pat: &IdentPat, ) -> Option<Self>
pub fn for_fuzzy_path( module_with_candidate: Module, qualifier: Option<Path>, fuzzy_name: String, sema: &Semantics<'db, RootDatabase>, candidate_node: SyntaxNode, ) -> Option<Self>
pub fn for_fuzzy_method_call( module_with_method_call: Module, receiver_ty: Type<'db>, fuzzy_method_name: String, candidate_node: SyntaxNode, ) -> Option<Self>
Source§impl<'db> ImportAssets<'db>
impl<'db> ImportAssets<'db>
pub fn import_candidate(&self) -> &ImportCandidate<'db>
pub fn search_for_imports( &self, sema: &Semantics<'db, RootDatabase>, cfg: ImportPathConfig, prefix_kind: PrefixKind, ) -> impl Iterator<Item = LocatedImport>
Sourcepub fn search_for_relative_paths(
&self,
sema: &Semantics<'db, RootDatabase>,
cfg: ImportPathConfig,
) -> impl Iterator<Item = LocatedImport>
pub fn search_for_relative_paths( &self, sema: &Semantics<'db, RootDatabase>, cfg: ImportPathConfig, ) -> impl Iterator<Item = LocatedImport>
This may return non-absolute paths if a part of the returned path is already imported into scope.
Sourcepub fn path_fuzzy_name_to_prefix(&mut self)
pub fn path_fuzzy_name_to_prefix(&mut self)
Requires imports to by prefix instead of fuzzily.
Sourcepub fn path_fuzzy_name_to_exact(&mut self)
pub fn path_fuzzy_name_to_exact(&mut self)
Requires imports to match exactly instead of fuzzily.
Trait Implementations§
Auto Trait Implementations§
impl<'db> Freeze for ImportAssets<'db>
impl<'db> !RefUnwindSafe for ImportAssets<'db>
impl<'db> !Send for ImportAssets<'db>
impl<'db> !Sync for ImportAssets<'db>
impl<'db> Unpin for ImportAssets<'db>
impl<'db> !UnwindSafe for ImportAssets<'db>
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
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§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