Fix doc comment links.

This commit is contained in:
Stephen Chung
2021-11-20 21:29:36 +08:00
parent fa41f4faf0
commit 90200e607c
11 changed files with 100 additions and 90 deletions

View File

@@ -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(