Struct rhai::Definitions
source · pub struct Definitions<'e> { /* private fields */ }
Expand description
(metadata, internals) Definitions helper type to generate definition files based on the
contents of an Engine
.
Exported under the internals
and metadata
feature only.
Implementations§
source§impl Definitions<'_>
impl Definitions<'_>
sourcepub const fn with_headers(self, headers: bool) -> Self
pub const fn with_headers(self, headers: bool) -> Self
Write module ...
headers in separate definitions, default false
.
Headers are always present in content that is expected to be written to a file
(i.e. write_to*
and *_file
methods).
sourcepub const fn include_standard_packages(
self,
include_standard_packages: bool
) -> Self
pub const fn include_standard_packages( self, include_standard_packages: bool ) -> Self
Include standard packages when writing definition files.
source§impl Definitions<'_>
impl Definitions<'_>
sourcepub fn write_to_dir(&self, path: impl AsRef<Path>) -> Result<()>
pub fn write_to_dir(&self, path: impl AsRef<Path>) -> Result<()>
Output all definition files returned from iter_files
to a
specified directory.
This function creates the directories and overrides any existing files if needed.
sourcepub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<()>
pub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<()>
Output all definitions merged into a single file.
The parent directory must exist but the file will be created or overwritten as needed.
sourcepub fn single_file(&self) -> String
pub fn single_file(&self) -> String
Return all definitions merged into a single file.
sourcepub fn iter_files(&self) -> impl Iterator<Item = (String, String)> + '_
pub fn iter_files(&self) -> impl Iterator<Item = (String, String)> + '_
Iterate over generated definition files.
The returned iterator yields all definition files as (filename, content) pairs.
sourcepub fn builtin_functions(&self) -> String
pub fn builtin_functions(&self) -> String
Return definitions for all builtin functions.
sourcepub fn builtin_functions_operators(&self) -> String
pub fn builtin_functions_operators(&self) -> String
Return definitions for all builtin operators.
sourcepub fn static_module(&self) -> String
pub fn static_module(&self) -> String
Return definitions for all globally available functions and constants.
sourcepub fn scope_items(&self) -> String
pub fn scope_items(&self) -> String
Return definitions for all items inside the Scope
, if any.
source§impl Definitions<'_>
impl Definitions<'_>
sourcepub fn json(&self) -> Result<String>
pub fn json(&self) -> Result<String>
Generate a list of all functions in JSON format.
Functions from the following sources are included:
- Functions defined in an
AST
- Functions registered into the global namespace
- Functions in static modules
- Functions in registered global packages
- Functions in standard packages (optional)
Trait Implementations§
source§impl<'e> Clone for Definitions<'e>
impl<'e> Clone for Definitions<'e>
source§fn clone(&self) -> Definitions<'e>
fn clone(&self) -> Definitions<'e>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'e> Freeze for Definitions<'e>
impl<'e> !RefUnwindSafe for Definitions<'e>
impl<'e> !Send for Definitions<'e>
impl<'e> !Sync for Definitions<'e>
impl<'e> Unpin for Definitions<'e>
impl<'e> !UnwindSafe for Definitions<'e>
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
source§impl<T> Variant for T
impl<T> Variant for T
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Variant
trait object to &mut dyn Any
.source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Variant
trait object to Box<dyn Any>
.