sdml_core::store

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 with_stdlib(self) -> Self

Construct a cache with all of the standard library modules pre-inserted.

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

source§

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

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

impl Default for InMemoryModuleCache

source§

fn default() -> InMemoryModuleCache

Returns the “default value” for a type. 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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

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