Struct ra_ap_hir::Module [−][src]
pub struct Module { /* fields omitted */ }
Implementations
impl Module
[src]
impl Module
[src]NB: Module is !HasSource, because it has two source nodes at the same time: definition and declaration.
pub fn definition_source(self, db: &dyn HirDatabase) -> InFile<ModuleSource>
[src]
pub fn definition_source(self, db: &dyn HirDatabase) -> InFile<ModuleSource>
[src]Returns a node which defines this module. That is, a file or a mod foo {}
with items.
pub fn is_mod_rs(self, db: &dyn HirDatabase) -> bool
[src]
pub fn declaration_source(self, db: &dyn HirDatabase) -> Option<InFile<Module>>
[src]
pub fn declaration_source(self, db: &dyn HirDatabase) -> Option<InFile<Module>>
[src]Returns a node which declares this module, either a mod foo;
or a mod foo {}
.
None
for the crate root.
impl Module
[src]
impl Module
[src]pub fn name(self, db: &dyn HirDatabase) -> Option<Name>
[src]
pub fn name(self, db: &dyn HirDatabase) -> Option<Name>
[src]Name of this module.
pub fn crate_root(self, db: &dyn HirDatabase) -> Module
[src]
pub fn crate_root(self, db: &dyn HirDatabase) -> Module
[src]Topmost parent of this module. Every module has a crate_root
, but some
might be missing krate
. This can happen if a module’s file is not included
in the module tree of any target in Cargo.toml
.
pub fn children(self, db: &dyn HirDatabase) -> impl Iterator<Item = Module>
[src]
pub fn children(self, db: &dyn HirDatabase) -> impl Iterator<Item = Module>
[src]Iterates over all child modules.
pub fn parent(self, db: &dyn HirDatabase) -> Option<Module>
[src]
pub fn parent(self, db: &dyn HirDatabase) -> Option<Module>
[src]Finds a parent module.
pub fn path_to_root(self, db: &dyn HirDatabase) -> Vec<Module>
[src]
pub fn scope(
self,
db: &dyn HirDatabase,
visible_from: Option<Module>
) -> Vec<(Name, ScopeDef)>
[src]
pub fn scope(
self,
db: &dyn HirDatabase,
visible_from: Option<Module>
) -> Vec<(Name, ScopeDef)>
[src]Returns a ModuleScope
: a set of items, visible in this module.
pub fn visibility_of(
self,
db: &dyn HirDatabase,
def: &ModuleDef
) -> Option<Visibility>
[src]
self,
db: &dyn HirDatabase,
def: &ModuleDef
) -> Option<Visibility>
pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink<'_>)
[src]
pub fn declarations(self, db: &dyn HirDatabase) -> Vec<ModuleDef>
[src]
pub fn impl_defs(self, db: &dyn HirDatabase) -> Vec<Impl>
[src]
pub fn find_use_path(
self,
db: &dyn DefDatabase,
item: impl Into<ItemInNs>
) -> Option<ModPath>
[src]
pub fn find_use_path(
self,
db: &dyn DefDatabase,
item: impl Into<ItemInNs>
) -> Option<ModPath>
[src]Finds a path that can be used to refer to the given item from within this module, if possible.
pub fn find_use_path_prefixed(
self,
db: &dyn DefDatabase,
item: impl Into<ItemInNs>,
prefix_kind: PrefixKind
) -> Option<ModPath>
[src]
pub fn find_use_path_prefixed(
self,
db: &dyn DefDatabase,
item: impl Into<ItemInNs>,
prefix_kind: PrefixKind
) -> Option<ModPath>
[src]Finds a path that can be used to refer to the given item from within this module, if possible. This is used for returning import paths for use-statements.
Trait Implementations
impl HasAttrs for Module
[src]
impl HasAttrs for Module
[src]fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner
[src]
fn docs(self, db: &dyn HirDatabase) -> Option<Documentation>
[src]
fn resolve_doc_path(
self,
db: &dyn HirDatabase,
link: &str,
ns: Option<Namespace>
) -> Option<ModuleDef>
[src]
self,
db: &dyn HirDatabase,
link: &str,
ns: Option<Namespace>
) -> Option<ModuleDef>
impl HirDisplay for Module
[src]
impl HirDisplay for Module
[src]fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError>
[src]
fn into_displayable(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> HirDisplayWrapper<'a, Self>
[src]
fn into_displayable(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>,
omit_verbose_types: bool,
display_target: DisplayTarget
) -> HirDisplayWrapper<'a, Self>
[src]Returns a Display
able type that is human-readable.
fn display(
&'a self,
db: &'a (dyn HirDatabase + 'a)
) -> HirDisplayWrapper<'a, Self>
[src]
fn display(
&'a self,
db: &'a (dyn HirDatabase + 'a)
) -> HirDisplayWrapper<'a, Self>
[src]Returns a Display
able type that is human-readable.
Use this for showing types to the user (e.g. diagnostics) Read more
fn display_truncated(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>
[src]
fn display_truncated(
&'a self,
db: &'a (dyn HirDatabase + 'a),
max_size: Option<usize>
) -> HirDisplayWrapper<'a, Self>
[src]Returns a Display
able type that is human-readable and tries to be succinct.
Use this for showing types to the user where space is constrained (e.g. doc popups) Read more
fn display_source_code(
&'a self,
db: &'a (dyn HirDatabase + 'a),
module_id: ModuleId
) -> Result<String, DisplaySourceCodeError>
[src]
fn display_source_code(
&'a self,
db: &'a (dyn HirDatabase + 'a),
module_id: ModuleId
) -> Result<String, DisplaySourceCodeError>
[src]Returns a String representation of self
that can be inserted into the given module.
Use this when generating code (e.g. assists) Read more
fn display_test(
&'a self,
db: &'a (dyn HirDatabase + 'a)
) -> HirDisplayWrapper<'a, Self>
[src]
fn display_test(
&'a self,
db: &'a (dyn HirDatabase + 'a)
) -> HirDisplayWrapper<'a, Self>
[src]Returns a String representation of self
for test purposes
impl Copy for Module
[src]
impl Eq for Module
[src]
impl StructuralEq for Module
[src]
impl StructuralPartialEq for Module
[src]
Auto Trait Implementations
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]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
.
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> Any for T where
T: Any,
T: Any,
impl<T> CloneAny for T where
T: Any + Clone,
T: Any + Clone,