Struct InMemoryModuleCache

Source
pub struct InMemoryModuleCache { /* private fields */ }
Expand description

An implementation of ModuleStore that has no persistence it simply acts as an in-process cache.

Implementations§

Source§

impl InMemoryModuleCache

Source

pub fn empty() -> Self

Source

pub fn with_stdlib() -> Self

Source

pub fn with(self, module: Module) -> Self

Builder-like function to add a module to a newly constructed cache.

Trait Implementations§

Source§

impl Clone for InMemoryModuleCache

Source§

fn clone(&self) -> InMemoryModuleCache

Returns a duplicate 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 InMemoryModuleCache

Source§

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

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

impl ModuleStore for InMemoryModuleCache

Source§

fn len(&self) -> usize

Return the number of modules in the store.
Source§

fn contains(&self, name: &Identifier) -> bool

Returns true if the loader’s cache contains a module with the name name, else false.
Source§

fn contains_by_uri(&self, uri: &Url) -> bool

Returns true if the loader’s cache contains a module with the base URI uri, else false.
Source§

fn get(&self, name: &Identifier) -> Option<&Module>

Returns a reference to the Module identified by name if the store contains it; else None.
Source§

fn get_mut(&mut self, name: &Identifier) -> Option<&mut Module>

Returns a mutable reference to the Module identified by name if the store contains it; else None.
Source§

fn get_by_uri(&self, uri: &Url) -> Option<&Module>

Returns a reference to the Module identified by uri if the store contains it; else None.
Source§

fn get_by_uri_mut(&mut self, uri: &Url) -> Option<&mut Module>

Returns a mutable reference to the Module identified by uri if the store contains it; else None.
Source§

fn modules(&self) -> impl Iterator<Item = &Module>

Return an iterator over all modules in this store. This may be an expensive operation if modules only exist in some backing store.
Source§

fn module_names(&self) -> impl Iterator<Item = &Identifier>

Return an iterator over the names of the modules in this store.
Source§

fn insert(&mut self, module: Module)

Insert module into the store.
Source§

fn remove(&mut self, name: &Identifier) -> bool

Remove any module identified by name.
Source§

fn remove_by_uri(&mut self, uri: &Url) -> bool

Remove any module identified by uri.
Source§

fn uri_to_module_name(&self, url: &Url) -> Option<&Identifier>

Return the module name corresponding to the provided url if it exists, or else None.
Source§

fn module_name_to_uri(&self, id: &Identifier) -> Option<&Url>

Return the module URI corresponding to the provided name if it exists, or else None.
Source§

fn is_empty(&self) -> bool

Return true if there are no modules in this store, else false.
Source§

fn resolve(&self, definition: &QualifiedIdentifier) -> Option<&Definition>

Given a qualified identifier, find the named module or return None, then find the named member in the found module or return None. Read more
Source§

fn resolve_or_in( &self, definition: &IdentifierReference, in_module: &Identifier, ) -> Option<&Definition>

If definition is a QualifiedIdentifier this is the same as resolve; however, if definition is an Identifier then look for definition in the module named in_module. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,