pub struct ScriptEngine { /* private fields */ }Expand description
Script engine for executing Rhai scripts
Implementations§
Source§impl ScriptEngine
impl ScriptEngine
Sourcepub fn get_scripts_dir() -> Result<PathBuf>
pub fn get_scripts_dir() -> Result<PathBuf>
Get the default scripts directory
Sourcepub fn discover_scripts(&mut self) -> Result<usize>
pub fn discover_scripts(&mut self) -> Result<usize>
Discover and load all scripts from the scripts directory
Sourcepub fn get_script(&self, name: &str) -> Option<&Script>
pub fn get_script(&self, name: &str) -> Option<&Script>
Get a script by name
Sourcepub fn list_scripts(&self) -> Vec<&Script>
pub fn list_scripts(&self) -> Vec<&Script>
List all loaded scripts
Sourcepub fn execute_script(
&self,
name: &str,
context: ScriptContext,
) -> Result<ScriptResult>
pub fn execute_script( &self, name: &str, context: ScriptContext, ) -> Result<ScriptResult>
Execute a script with given context
Sourcepub fn install_script(&mut self, source_path: &Path) -> Result<()>
pub fn install_script(&mut self, source_path: &Path) -> Result<()>
Install a script from a file
Sourcepub fn uninstall_script(&mut self, name: &str) -> Result<()>
pub fn uninstall_script(&mut self, name: &str) -> Result<()>
Uninstall a script
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScriptEngine
impl RefUnwindSafe for ScriptEngine
impl Send for ScriptEngine
impl Sync for ScriptEngine
impl Unpin for ScriptEngine
impl UnwindSafe for ScriptEngine
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more