Struct rhai::module_resolvers::StaticModuleResolver [−][src]
A static module resolution service that serves modules added into it.
Example
use rhai::{Engine, Module}; use rhai::module_resolvers::StaticModuleResolver; let mut resolver = StaticModuleResolver::new(); let module = Module::new(); resolver.insert("hello", module); let mut engine = Engine::new(); engine.set_module_resolver(resolver);
Implementations
impl StaticModuleResolver
[src]
pub fn new() -> Self
[src]
Create a new StaticModuleResolver
.
Example
use rhai::{Engine, Module}; use rhai::module_resolvers::StaticModuleResolver; let mut resolver = StaticModuleResolver::new(); let module = Module::new(); resolver.insert("hello", module); let mut engine = Engine::new(); engine.set_module_resolver(resolver);
pub fn insert(&mut self, path: impl Into<String>, module: Module)
[src]
Add a module keyed by its path.
pub fn remove(&mut self, path: &str) -> Option<Shared<Module>>
[src]
Remove a module given its path.
pub fn contains_path(&self, path: &str) -> bool
[src]
Does the path exist?
pub fn iter(&self) -> impl Iterator<Item = (&str, &Shared<Module>)>
[src]
Get an iterator of all the modules.
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&str, &mut Shared<Module>)>
[src]
Get a mutable iterator of all the modules.
pub fn into_iter(self) -> impl Iterator<Item = (String, Shared<Module>)>
[src]
Get a mutable iterator of all the modules.
pub fn paths(&self) -> impl Iterator<Item = &str>
[src]
Get an iterator of all the module paths.
pub fn values(&self) -> impl Iterator<Item = &Shared<Module>>
[src]
Get an iterator of all the modules.
pub fn clear(&mut self)
[src]
Remove all modules.
pub fn is_empty(&self) -> bool
[src]
Is this StaticModuleResolver
empty?
pub fn len(&self) -> usize
[src]
Get the number of modules in this StaticModuleResolver
.
pub fn merge(&mut self, other: Self)
[src]
Merge another StaticModuleResolver
into this.
The other StaticModuleResolver
is consumed.
Existing modules of the same path name are overwritten.
Trait Implementations
impl AddAssign<StaticModuleResolver> for StaticModuleResolver
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl Clone for StaticModuleResolver
[src]
fn clone(&self) -> StaticModuleResolver
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for StaticModuleResolver
[src]
impl Default for StaticModuleResolver
[src]
fn default() -> StaticModuleResolver
[src]
impl ModuleResolver for StaticModuleResolver
[src]
Auto Trait Implementations
impl !RefUnwindSafe for StaticModuleResolver
impl !Send for StaticModuleResolver
impl !Sync for StaticModuleResolver
impl Unpin for StaticModuleResolver
impl !UnwindSafe for StaticModuleResolver
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,