Struct erg_compiler::module::global::SharedCompilerResource

source ·
pub struct SharedCompilerResource {
    pub mod_cache: SharedModuleCache,
    pub py_mod_cache: SharedModuleCache,
    pub index: SharedModuleIndex,
    pub graph: SharedModuleGraph,
    pub trait_impls: SharedTraitImpls,
    pub promises: SharedPromises,
    pub errors: SharedCompileErrors,
    pub warns: SharedCompileWarnings,
    pub gen_cache: SharedGeneralizationCache,
}

Fields§

§mod_cache: SharedModuleCache§py_mod_cache: SharedModuleCache§index: SharedModuleIndex§graph: SharedModuleGraph§trait_impls: SharedTraitImpls

K: name of a trait, V: (type, monomorphised trait that the type implements) K: トレイトの名前, V: (型, その型が実装する単相化トレイト) e.g. { “Named”: [(Type, Named), (Func, Named), …], “Add”: [(Nat, Add(Nat)), (Int, Add(Int)), …], … }

§promises: SharedPromises§errors: SharedCompileErrors§warns: SharedCompileWarnings§gen_cache: SharedGeneralizationCache

Implementations§

source§

impl SharedCompilerResource

source

pub fn new(cfg: ErgConfig) -> Self

Initialize the shared compiler resource. This API is normally called only once throughout the compilation phase.

source

pub fn inherit<P: Into<NormalizedPathBuf>>(&self, path: P) -> Self

source

pub fn clear_all(&self)

Clear all but builtin modules

source

pub fn clear(&self, path: &NormalizedPathBuf) -> Option<ModuleEntry>

Clear all information about the module. Graph information is not cleared (due to ELS).

source

pub fn clear_path(&self, path: &NormalizedPathBuf)

source

pub fn rename_path(&self, old: &NormalizedPathBuf, new: NormalizedPathBuf)

source

pub fn insert_module(&self, path: NormalizedPathBuf, entry: ModuleEntry)

source

pub fn remove_module(&self, path: &Path) -> Option<ModuleEntry>

This is intended to be called from a language server, etc., this blocks until it gets a lock.

source

pub fn get_module( &self, path: &Path ) -> Option<MappedRwLockReadGuard<'_, ModuleEntry>>

source

pub fn raw_ref_ctx_with_timeout( &self, path: &Path, timeout: Duration ) -> Option<&ModuleContext>

source

pub fn raw_ref_builtins_ctx(&self) -> Option<&ModuleContext>

source

pub fn raw_modules(&self) -> impl Iterator<Item = &ModuleEntry>

source

pub fn raw_path_and_modules( &self ) -> impl Iterator<Item = (&NormalizedPathBuf, &ModuleEntry)>

Trait Implementations§

source§

impl Clone for SharedCompilerResource

source§

fn clone(&self) -> SharedCompilerResource

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SharedCompilerResource

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SharedCompilerResource

source§

fn default() -> SharedCompilerResource

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.