Fix doc comment links.
This commit is contained in:
@@ -36,9 +36,9 @@ impl Engine {
|
||||
///
|
||||
/// ## Constants Propagation
|
||||
///
|
||||
/// If not [`OptimizationLevel::None`], constants defined within the scope are propagated
|
||||
/// throughout the script _including_ functions. This allows functions to be optimized based on
|
||||
/// dynamic global constants.
|
||||
/// If not [`OptimizationLevel::None`][crate::OptimizationLevel::None], constants defined within
|
||||
/// the scope are propagated throughout the script _including_ functions. This allows functions
|
||||
/// to be optimized based on dynamic global constants.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -81,7 +81,7 @@ impl Engine {
|
||||
/// Modules referred by `import` statements containing literal string paths are eagerly resolved
|
||||
/// via the current [module resolver][crate::ModuleResolver] and embedded into the resultant
|
||||
/// [`AST`]. When it is evaluated later, `import` statement directly recall pre-resolved
|
||||
/// [modules][Module] and the resolution process is not performed again.
|
||||
/// [modules][crate::Module] and the resolution process is not performed again.
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
pub fn compile_into_self_contained(
|
||||
&self,
|
||||
@@ -146,22 +146,22 @@ impl Engine {
|
||||
|
||||
Ok(ast)
|
||||
}
|
||||
/// When passed a list of strings, first join the strings into one large script,
|
||||
/// and then compile them into an [`AST`] using own scope, which can be used later for evaluation.
|
||||
/// When passed a list of strings, first join the strings into one large script, and then
|
||||
/// compile them into an [`AST`] using own scope, which can be used later for evaluation.
|
||||
///
|
||||
/// The scope is useful for passing constants into the script for optimization
|
||||
/// when using [`OptimizationLevel::Full`].
|
||||
/// The scope is useful for passing constants into the script for optimization when using
|
||||
/// [`OptimizationLevel::Full`][crate::OptimizationLevel::Full].
|
||||
///
|
||||
/// ## Note
|
||||
///
|
||||
/// All strings are simply parsed one after another with nothing inserted in between, not even
|
||||
/// a newline or space.
|
||||
/// All strings are simply parsed one after another with nothing inserted in between, not even a
|
||||
/// newline or space.
|
||||
///
|
||||
/// ## Constants Propagation
|
||||
///
|
||||
/// If not [`OptimizationLevel::None`], constants defined within the scope are propagated
|
||||
/// throughout the script _including_ functions. This allows functions to be optimized based on
|
||||
/// dynamic global constants.
|
||||
/// If not [`OptimizationLevel::None`][crate::OptimizationLevel::None], constants defined within
|
||||
/// the scope are propagated throughout the script _including_ functions. This allows functions
|
||||
/// to be optimized based on dynamic global constants.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
@@ -80,7 +80,7 @@ impl Engine {
|
||||
self.run_with_scope(scope, script)
|
||||
}
|
||||
|
||||
/// Evaluate an AST, but throw away the result and only return error (if any).
|
||||
/// Evaluate an [`AST`], but throw away the result and only return error (if any).
|
||||
/// Useful for when you don't need the result, but still need to keep track of possible errors.
|
||||
///
|
||||
/// # Deprecated
|
||||
|
@@ -31,9 +31,9 @@ impl Engine {
|
||||
///
|
||||
/// ## Constants Propagation
|
||||
///
|
||||
/// If not [`OptimizationLevel::None`], constants defined within the scope are propagated
|
||||
/// throughout the script _including_ functions. This allows functions to be optimized based on
|
||||
/// dynamic global constants.
|
||||
/// If not [`OptimizationLevel::None`][crate::OptimizationLevel::None], constants defined within
|
||||
/// the scope are propagated throughout the script _including_ functions. This allows functions
|
||||
/// to be optimized based on dynamic global constants.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
@@ -17,11 +17,11 @@ impl Engine {
|
||||
/// > ` -> Result<Option<Dynamic>, Box<EvalAltResult>> + 'static`
|
||||
///
|
||||
/// where:
|
||||
/// * `index`: an offset from the bottom of the current [`Scope`] that the variable is supposed
|
||||
/// to reside. Offsets start from 1, with 1 meaning the last variable in the current
|
||||
/// [`Scope`]. Essentially the correct variable is at position `scope.len() - index`.
|
||||
/// If `index` is zero, then there is no pre-calculated offset position and a search through the
|
||||
/// current [`Scope`] must be performed.
|
||||
/// * `index`: an offset from the bottom of the current [`Scope`][crate::Scope] that the
|
||||
/// variable is supposed to reside. Offsets start from 1, with 1 meaning the last variable in
|
||||
/// the current [`Scope`][crate::Scope]. Essentially the correct variable is at position
|
||||
/// `scope.len() - index`. If `index` is zero, then there is no pre-calculated offset position
|
||||
/// and a search through the current [`Scope`][crate::Scope] must be performed.
|
||||
///
|
||||
/// * `context`: the current [evaluation context][`EvalContext`].
|
||||
///
|
||||
|
@@ -71,9 +71,9 @@ impl Engine {
|
||||
///
|
||||
/// ## Constants Propagation
|
||||
///
|
||||
/// If not [`OptimizationLevel::None`], constants defined within the scope are propagated
|
||||
/// throughout the script _including_ functions. This allows functions to be optimized based on
|
||||
/// dynamic global constants.
|
||||
/// If not [`OptimizationLevel::None`][crate::OptimizationLevel::None], constants defined within
|
||||
/// the scope are propagated throughout the script _including_ functions. This allows functions
|
||||
/// to be optimized based on dynamic global constants.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -136,9 +136,9 @@ impl Engine {
|
||||
///
|
||||
/// ## Constants Propagation
|
||||
///
|
||||
/// If not [`OptimizationLevel::None`], constants defined within the scope are propagated
|
||||
/// throughout the script _including_ functions. This allows functions to be optimized based on
|
||||
/// dynamic global constants.
|
||||
/// If not [`OptimizationLevel::None`][crate::OptimizationLevel::None], constants defined within
|
||||
/// the scope are propagated throughout the script _including_ functions. This allows functions
|
||||
/// to be optimized based on dynamic global constants.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -180,9 +180,9 @@ impl Engine {
|
||||
///
|
||||
/// ## Constants Propagation
|
||||
///
|
||||
/// If not [`OptimizationLevel::None`], constants defined within the scope are propagated
|
||||
/// throughout the script _including_ functions. This allows functions to be optimized based on
|
||||
/// dynamic global constants.
|
||||
/// If not [`OptimizationLevel::None`][crate::OptimizationLevel::None], constants defined within
|
||||
/// the scope are propagated throughout the script _including_ functions. This allows functions
|
||||
/// to be optimized based on dynamic global constants.
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
|
||||
#[inline]
|
||||
|
@@ -1,17 +1,25 @@
|
||||
//! Module defining the public API of the Rhai engine.
|
||||
|
||||
pub mod call_fn;
|
||||
pub mod compile;
|
||||
pub mod deprecated;
|
||||
pub mod eval;
|
||||
pub mod events;
|
||||
|
||||
pub mod run;
|
||||
|
||||
pub mod compile;
|
||||
|
||||
#[cfg(not(feature = "no_std"))]
|
||||
#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
|
||||
pub mod files;
|
||||
|
||||
pub mod register;
|
||||
|
||||
pub mod call_fn;
|
||||
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
pub mod limits;
|
||||
pub mod register;
|
||||
pub mod run;
|
||||
|
||||
pub mod events;
|
||||
|
||||
pub mod deprecated;
|
||||
|
||||
use crate::engine::Precedence;
|
||||
use crate::tokenizer::Token;
|
||||
@@ -43,21 +51,21 @@ impl Engine {
|
||||
pub const fn optimization_level(&self) -> crate::OptimizationLevel {
|
||||
self.optimization_level
|
||||
}
|
||||
/// Optimize the [`AST`] with constants defined in an external Scope.
|
||||
/// An optimized copy of the [`AST`] is returned while the original [`AST`] is consumed.
|
||||
/// Optimize the [`AST`][crate::AST] with constants defined in an external Scope. An optimized
|
||||
/// copy of the [`AST`][crate::AST] is returned while the original [`AST`][crate::AST] is consumed.
|
||||
///
|
||||
/// Not available under `no_optimize`.
|
||||
///
|
||||
/// Although optimization is performed by default during compilation, sometimes it is necessary to
|
||||
/// _re_-optimize an [`AST`]. For example, when working with constants that are passed in via an
|
||||
/// external scope, it will be more efficient to optimize the [`AST`] once again to take advantage
|
||||
/// of the new constants.
|
||||
/// Although optimization is performed by default during compilation, sometimes it is necessary
|
||||
/// to _re_-optimize an [`AST`][crate::AST]. For example, when working with constants that are
|
||||
/// passed in via an external scope, it will be more efficient to optimize the
|
||||
/// [`AST`][crate::AST] once again to take advantage of the new constants.
|
||||
///
|
||||
/// With this method, it is no longer necessary to recompile a large script.
|
||||
/// The script [`AST`] can be compiled just once. Before evaluation,
|
||||
/// constants are passed into the [`Engine`] via an external scope
|
||||
/// (i.e. with [`Scope::push_constant`]).
|
||||
/// Then, the [`AST`] is cloned and the copy re-optimized before running.
|
||||
/// With this method, it is no longer necessary to recompile a large script. The script
|
||||
/// [`AST`][crate::AST] can be compiled just once. Before evaluation, constants are passed into
|
||||
/// the [`Engine`] via an external scope (i.e. with
|
||||
/// [`Scope::push_constant`][crate::Scope::push_constant]). Then, the [`AST`][crate::AST] is
|
||||
/// cloned and the copy re-optimized before running.
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn optimize_ast(
|
||||
|
@@ -154,7 +154,7 @@ impl Engine {
|
||||
///
|
||||
/// This function is very low level. It takes a list of [`TypeId`][std::any::TypeId]'s indicating the actual types of the parameters.
|
||||
///
|
||||
/// Arguments are simply passed in as a mutable array of [`&mut Dynamic`][Dynamic],
|
||||
/// Arguments are simply passed in as a mutable array of [`&mut Dynamic`][crate::Dynamic],
|
||||
/// The arguments are guaranteed to be of the correct types matching the [`TypeId`][std::any::TypeId]'s.
|
||||
///
|
||||
/// To access a primary argument value (i.e. cloning is cheap), use: `args[n].as_xxx().unwrap()`
|
||||
|
@@ -16,9 +16,9 @@ impl Engine {
|
||||
///
|
||||
/// ## Constants Propagation
|
||||
///
|
||||
/// If not [`OptimizationLevel::None`], constants defined within the scope are propagated
|
||||
/// throughout the script _including_ functions. This allows functions to be optimized based on
|
||||
/// dynamic global constants.
|
||||
/// If not [`OptimizationLevel::None`][crate::OptimizationLevel::None], constants defined within
|
||||
/// the scope are propagated throughout the script _including_ functions. This allows functions
|
||||
/// to be optimized based on dynamic global constants.
|
||||
#[inline]
|
||||
pub fn run_with_scope(
|
||||
&self,
|
||||
@@ -40,7 +40,7 @@ impl Engine {
|
||||
|
||||
self.run_ast_with_scope(scope, &ast)
|
||||
}
|
||||
/// Evaluate an AST, returning any error (if any).
|
||||
/// Evaluate an [`AST`], returning any error (if any).
|
||||
#[inline(always)]
|
||||
pub fn run_ast(&self, ast: &AST) -> Result<(), Box<EvalAltResult>> {
|
||||
self.run_ast_with_scope(&mut Scope::new(), ast)
|
||||
|
Reference in New Issue
Block a user