Struct rhai::module_resolvers::ModuleResolversCollection[][src]

pub struct ModuleResolversCollection(_);

Module resolution service that holds a collection of module resolvers, to be searched in sequential order.

Example

use rhai::{Engine, Module};
use rhai::module_resolvers::{StaticModuleResolver, ModuleResolversCollection};

let mut collection = ModuleResolversCollection::new();

let resolver = StaticModuleResolver::new();
collection.push(resolver);

let mut engine = Engine::new();
engine.set_module_resolver(collection);

Implementations

impl ModuleResolversCollection[src]

pub fn new() -> Self[src]

Create a new ModuleResolversCollection.

Example

use rhai::{Engine, Module};
use rhai::module_resolvers::{StaticModuleResolver, ModuleResolversCollection};

let mut collection = ModuleResolversCollection::new();

let resolver = StaticModuleResolver::new();
collection.push(resolver);

let mut engine = Engine::new();
engine.set_module_resolver(collection);

pub fn push(&mut self, resolver: impl ModuleResolver + 'static) -> &mut Self

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<'_, F> Future for &'_ mut F where
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Append a module resolver to the end.

pub fn insert(
    &mut self,
    index: usize,
    resolver: impl ModuleResolver + 'static
) -> &mut Self

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<'_, F> Future for &'_ mut F where
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Insert a module resolver to an offset index.

Panics

Panics if the index is out of bounds.

pub fn pop(&mut self) -> Option<Box<dyn ModuleResolver>>[src]

Remove the last module resolver from the end, if any.

pub fn remove(&mut self, index: usize) -> Box<dyn ModuleResolver>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;
[src]

Remove a module resolver at an offset index.

Panics

Panics if the index is out of bounds.

pub fn iter(&self) -> impl Iterator<Item = &dyn ModuleResolver>[src]

Get an iterator of all the module resolvers.

pub fn into_iter(self) -> impl Iterator<Item = Box<dyn ModuleResolver>>[src]

Get a mutable iterator of all the module resolvers.

pub fn clear(&mut self) -> &mut Self

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<'_, F> Future for &'_ mut F where
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Remove all module resolvers.

pub fn is_empty(&self) -> bool[src]

pub fn len(&self) -> usize[src]

Get the number of module resolvers in this ModuleResolversCollection.

pub fn append(&mut self, other: Self) -> &mut Self

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<'_, F> Future for &'_ mut F where
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Add another ModuleResolversCollection to the end of this collection. The other ModuleResolversCollection is consumed.

Trait Implementations

impl<M: ModuleResolver + 'static> AddAssign<M> for ModuleResolversCollection[src]

impl Default for ModuleResolversCollection[src]

impl ModuleResolver for ModuleResolversCollection[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.