pub struct ModuleId(/* private fields */);
Expand description
Id of a Module
, which corresponds to a single Fe source file.
Implementations§
Source§impl ModuleId
impl ModuleId
pub fn new_standalone( db: &mut dyn AnalyzerDb, path: &str, content: &str, ) -> Self
pub fn new( db: &dyn AnalyzerDb, name: &str, source: ModuleSource, ingot: IngotId, ) -> Self
pub fn data(&self, db: &dyn AnalyzerDb) -> Rc<Module>
pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr
pub fn file_path_relative_to_src_dir(&self, db: &dyn AnalyzerDb) -> SmolStr
pub fn ast(&self, db: &dyn AnalyzerDb) -> Rc<Module>
pub fn ingot(&self, db: &dyn AnalyzerDb) -> IngotId
pub fn is_incomplete(&self, db: &dyn AnalyzerDb) -> bool
pub fn is_in_std(&self, db: &dyn AnalyzerDb) -> bool
Sourcepub fn all_items(&self, db: &dyn AnalyzerDb) -> Rc<[Item]>
pub fn all_items(&self, db: &dyn AnalyzerDb) -> Rc<[Item]>
Includes duplicate names
Sourcepub fn all_impls(&self, db: &dyn AnalyzerDb) -> Rc<[ImplId]>
pub fn all_impls(&self, db: &dyn AnalyzerDb) -> Rc<[ImplId]>
Includes duplicate names
pub fn impls( &self, db: &dyn AnalyzerDb, ) -> Rc<IndexMap<(TraitId, TypeId), ImplId>>
Sourcepub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>>
pub fn items(&self, db: &dyn AnalyzerDb) -> Rc<IndexMap<SmolStr, Item>>
Returns a map of the named items in the module
Sourcepub fn used_items(
&self,
db: &dyn AnalyzerDb,
) -> Rc<IndexMap<SmolStr, (Span, Item)>>
pub fn used_items( &self, db: &dyn AnalyzerDb, ) -> Rc<IndexMap<SmolStr, (Span, Item)>>
Returns a name -> (name_span, external_item)
map for all use
statements in a module.
pub fn tests(&self, db: &dyn AnalyzerDb) -> Vec<FunctionId>
Sourcepub fn is_in_scope(&self, db: &dyn AnalyzerDb, item: Item) -> bool
pub fn is_in_scope(&self, db: &dyn AnalyzerDb, item: Item) -> bool
Returns true
if the item
is in scope of the module.
Sourcepub fn non_used_internal_items(
&self,
db: &dyn AnalyzerDb,
) -> IndexMap<SmolStr, Item>
pub fn non_used_internal_items( &self, db: &dyn AnalyzerDb, ) -> IndexMap<SmolStr, Item>
Returns all of the internal items, except for use
d items. This is used
when resolving use
statements, as it does not create a query
cycle.
Sourcepub fn internal_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item>
pub fn internal_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item>
Returns all of the internal items. Internal items refers to the set of items visible when inside of a module.
Sourcepub fn resolve_path(
&self,
db: &dyn AnalyzerDb,
path: &Path,
) -> Analysis<Option<NamedThing>>
pub fn resolve_path( &self, db: &dyn AnalyzerDb, path: &Path, ) -> Analysis<Option<NamedThing>>
Resolve a path that starts with an item defined in the module.
Sourcepub fn resolve_path_non_used_internal(
&self,
db: &dyn AnalyzerDb,
path: &Path,
) -> Analysis<Option<NamedThing>>
pub fn resolve_path_non_used_internal( &self, db: &dyn AnalyzerDb, path: &Path, ) -> Analysis<Option<NamedThing>>
Resolve a path that starts with an internal item. We omit used items to avoid a query cycle.
Sourcepub fn resolve_path_internal(
&self,
db: &dyn AnalyzerDb,
path: &Path,
) -> Analysis<Option<NamedThing>>
pub fn resolve_path_internal( &self, db: &dyn AnalyzerDb, path: &Path, ) -> Analysis<Option<NamedThing>>
Resolve a path that starts with an internal item.
Sourcepub fn resolve_name(
&self,
db: &dyn AnalyzerDb,
name: &str,
) -> Result<Option<NamedThing>, IncompleteItem>
pub fn resolve_name( &self, db: &dyn AnalyzerDb, name: &str, ) -> Result<Option<NamedThing>, IncompleteItem>
Returns Err(IncompleteItem)
if the name could not be resolved, and the
module was not completely parsed (due to a syntax error).
pub fn resolve_constant( &self, db: &dyn AnalyzerDb, name: &str, ) -> Result<Option<ModuleConstantId>, IncompleteItem>
pub fn submodules(&self, db: &dyn AnalyzerDb) -> Rc<[ModuleId]>
pub fn parent(&self, db: &dyn AnalyzerDb) -> Item
pub fn parent_module(&self, db: &dyn AnalyzerDb) -> Option<ModuleId>
Sourcepub fn all_contracts(&self, db: &dyn AnalyzerDb) -> Vec<ContractId>
pub fn all_contracts(&self, db: &dyn AnalyzerDb) -> Vec<ContractId>
All contracts, including from submodules and including duplicates
Sourcepub fn all_functions(&self, db: &dyn AnalyzerDb) -> Vec<FunctionId>
pub fn all_functions(&self, db: &dyn AnalyzerDb) -> Vec<FunctionId>
All functions, including from submodules and including duplicates
Sourcepub fn global_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item>
pub fn global_items(&self, db: &dyn AnalyzerDb) -> IndexMap<SmolStr, Item>
Returns the map of ingot deps, built-ins, and the ingot itself as “ingot”.
Sourcepub fn all_constants(&self, db: &dyn AnalyzerDb) -> Rc<Vec<ModuleConstantId>>
pub fn all_constants(&self, db: &dyn AnalyzerDb) -> Rc<Vec<ModuleConstantId>>
All module constants.
pub fn diagnostics(&self, db: &dyn AnalyzerDb) -> Vec<Diagnostic>
pub fn sink_diagnostics( &self, db: &dyn AnalyzerDb, sink: &mut impl DiagnosticSink, )
Trait Implementations§
Source§impl InternKey for ModuleId
impl InternKey for ModuleId
Source§fn from_intern_id(v: InternId) -> Self
fn from_intern_id(v: InternId) -> Self
u32
value.Source§fn as_intern_id(&self) -> InternId
fn as_intern_id(&self) -> InternId
u32
with which the intern-key was created.Source§impl Ord for ModuleId
impl Ord for ModuleId
Source§impl PartialOrd for ModuleId
impl PartialOrd for ModuleId
impl Copy for ModuleId
impl Eq for ModuleId
impl StructuralPartialEq for ModuleId
Auto Trait Implementations§
impl Freeze for ModuleId
impl RefUnwindSafe for ModuleId
impl Send for ModuleId
impl Sync for ModuleId
impl Unpin for ModuleId
impl UnwindSafe for ModuleId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§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
§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
key
and return true
if they are equal.