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 PathBuf: Borrow<P>,
pub fn get_mut<Q: Eq + Hash + ?Sized>( &mut self, path: &Q ) -> Option<&mut ModuleEntry>where PathBuf: Borrow<Q>,
pub fn register(&mut self, path: PathBuf, hir: Option<HIR>, ctx: ModuleContext)
pub fn remove<Q: Eq + Hash + ?Sized>(&mut self, path: &Q) -> Option<ModuleEntry>where PathBuf: 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: &PathBuf, new: PathBuf)
pub fn iter(&self) -> impl Iterator<Item = (&PathBuf, &ModuleEntry)>
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
Auto Trait Implementations§
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