Struct erg_compiler::module::cache::ModuleCache
source · pub struct ModuleCache { /* private fields */ }
Expand description
Caches checked modules. In addition to being queried here when re-imported, it is also used when linking (Erg links all scripts defined in erg and outputs them to a single pyc file).
Implementations§
source§impl ModuleCache
impl ModuleCache
pub fn new() -> Self
pub fn get<P: Eq + Hash + ?Sized>(&self, path: &P) -> Option<&ModuleEntry>where
NormalizedPathBuf: Borrow<P>,
pub fn get_mut<Q: Eq + Hash + ?Sized>(
&mut self,
path: &Q,
) -> Option<&mut ModuleEntry>where
NormalizedPathBuf: Borrow<Q>,
pub fn register( &mut self, path: NormalizedPathBuf, ast: Option<Module>, hir: Option<HIR>, ctx: ModuleContext, status: CheckStatus, )
pub fn remove<Q: Eq + Hash + ?Sized>(&mut self, path: &Q) -> Option<ModuleEntry>where
NormalizedPathBuf: Borrow<Q>,
pub fn remove_by_id(&mut self, id: ModId) -> Option<ModuleEntry>
pub fn get_similar_name(&self, name: &str) -> Option<Str>
pub fn rename_path(&mut self, old: &NormalizedPathBuf, new: NormalizedPathBuf)
pub fn iter(&self) -> impl Iterator<Item = (&NormalizedPathBuf, &ModuleEntry)>
pub fn values(&self) -> impl Iterator<Item = &ModuleEntry>
pub fn clear(&mut self)
pub fn take(&mut self) -> Self
Trait Implementations§
source§impl Debug for ModuleCache
impl Debug for ModuleCache
source§impl Default for ModuleCache
impl Default for ModuleCache
source§fn default() -> ModuleCache
fn default() -> ModuleCache
Returns the “default value” for a type. Read more
source§impl Display for ModuleCache
impl Display for ModuleCache
source§impl IntoIterator for ModuleCache
impl IntoIterator for ModuleCache
source§type Item = (NormalizedPathBuf, ModuleEntry)
type Item = (NormalizedPathBuf, ModuleEntry)
The type of the elements being iterated over.
source§type IntoIter = IntoIter<NormalizedPathBuf, ModuleEntry>
type IntoIter = IntoIter<NormalizedPathBuf, ModuleEntry>
Which kind of iterator are we turning this into?
Auto Trait Implementations§
impl Freeze for ModuleCache
impl !RefUnwindSafe for ModuleCache
impl Send for ModuleCache
impl Sync for ModuleCache
impl Unpin for ModuleCache
impl !UnwindSafe for ModuleCache
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