pub struct DylibModuleResolver { /* private fields */ }Expand description
A module resolver that load dynamic libraries pointed by the import path.
Implementations§
Source§impl DylibModuleResolver
impl DylibModuleResolver
Sourcepub fn enable_cache(&mut self, enable: bool) -> &mut Self
pub fn enable_cache(&mut self, enable: bool) -> &mut Self
Enable/disable the cache.
Sourcepub const fn is_cache_enabled(&self) -> bool
pub const fn is_cache_enabled(&self) -> bool
Is the cache enabled?
Sourcepub fn with_path(path: impl Into<PathBuf>) -> Self
pub fn with_path(path: impl Into<PathBuf>) -> Self
Create a new DylibModuleResolver with a specific base path.
§Example
ⓘ
use rhai::Engine;
use rhai_dylib::module_resolvers::libloading::DylibModuleResolver;
// Create a new 'DylibModuleResolver' loading dynamic libraries
// from the 'scripts' directory.
let resolver = DylibModuleResolver::with_path("./scripts");
let mut engine = Engine::new();
engine.set_module_resolver(resolver);Trait Implementations§
Source§impl Default for DylibModuleResolver
impl Default for DylibModuleResolver
Source§impl ModuleResolver for DylibModuleResolver
impl ModuleResolver for DylibModuleResolver
Source§fn resolve_ast(
&self,
_: &Engine,
_: Option<&str>,
_: &str,
_: Position,
) -> Option<Result<AST, Box<EvalAltResult>>>
fn resolve_ast( &self, _: &Engine, _: Option<&str>, _: &str, _: Position, ) -> Option<Result<AST, Box<EvalAltResult>>>
This resolver is Rust based, so it cannot resolve ASTs.
This function will always return None.
Source§fn resolve(
&self,
_: &Engine,
source: Option<&str>,
path: &str,
position: Position,
) -> Result<Shared<Module>, Box<EvalAltResult>>
fn resolve( &self, _: &Engine, source: Option<&str>, path: &str, position: Position, ) -> Result<Shared<Module>, Box<EvalAltResult>>
Resolve a module based on a path string.
Source§fn resolve_raw(
&self,
_: &Engine,
global: &mut GlobalRuntimeState,
_: &mut Scope<'_>,
path: &str,
position: Position,
) -> Result<Shared<Module>, Box<EvalAltResult>>
fn resolve_raw( &self, _: &Engine, global: &mut GlobalRuntimeState, _: &mut Scope<'_>, path: &str, position: Position, ) -> Result<Shared<Module>, Box<EvalAltResult>>
Resolve a module based on a path string, given a
GlobalRuntimeState and the current Scope. Read moreAuto Trait Implementations§
impl !Freeze for DylibModuleResolver
impl !RefUnwindSafe for DylibModuleResolver
impl !Send for DylibModuleResolver
impl !Sync for DylibModuleResolver
impl Unpin for DylibModuleResolver
impl !UnwindSafe for DylibModuleResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more