Refine docs and comments etc.
This commit is contained in:
@@ -7,21 +7,15 @@ use crate::stdlib::{
|
||||
};
|
||||
use crate::{Engine, EvalAltResult, Module, ModuleResolver, Position, Shared};
|
||||
|
||||
/// Module resolution service that loads module script files from the file system.
|
||||
/// [Module] resolution service that loads [module][Module] script files from the file system.
|
||||
///
|
||||
/// Script files are cached so they are are not reloaded and recompiled in subsequent requests.
|
||||
///
|
||||
/// The [`new_with_path`][FileModuleResolver::new_with_path] and
|
||||
/// [`new_with_path_and_extension`][FileModuleResolver::new_with_path_and_extension] constructor functions
|
||||
/// allow specification of a base directory with module path used as a relative path offset
|
||||
/// to the base directory. The script file is then forced to be in a specified extension
|
||||
/// (default `.rhai`).
|
||||
///
|
||||
/// # Function Namespace
|
||||
///
|
||||
/// When a function within a script file module is loaded, all functions in the _global_ namespace
|
||||
/// When a function within a script file module is called, all functions in the _global_ namespace
|
||||
/// plus all those defined within the same module are _merged_ into a _unified_ namespace before
|
||||
/// the call. Therefore, functions in a module script can cross-call each other.
|
||||
/// the call. Therefore, functions in a module script can always cross-call each other.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -58,6 +52,8 @@ impl Default for FileModuleResolver {
|
||||
impl FileModuleResolver {
|
||||
/// Create a new [`FileModuleResolver`] with a specific base path.
|
||||
///
|
||||
/// The default extension is `.rhai`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
@@ -78,8 +74,6 @@ impl FileModuleResolver {
|
||||
|
||||
/// Create a new [`FileModuleResolver`] with a specific base path and file extension.
|
||||
///
|
||||
/// The default extension is `.rhai`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
@@ -107,6 +101,8 @@ impl FileModuleResolver {
|
||||
|
||||
/// Create a new [`FileModuleResolver`] with the current directory as base path.
|
||||
///
|
||||
/// The default extension is `.rhai`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
@@ -159,7 +155,9 @@ impl FileModuleResolver {
|
||||
self.cache.write().unwrap().clear();
|
||||
}
|
||||
|
||||
/// Empty the internal cache.
|
||||
/// Remove the specified path from internal cache.
|
||||
///
|
||||
/// The next time this path is resolved, the script file will be loaded once again.
|
||||
#[inline(always)]
|
||||
pub fn clear_cache_for_path(&mut self, path: impl AsRef<Path>) -> Option<Shared<Module>> {
|
||||
#[cfg(not(feature = "sync"))]
|
||||
|
Reference in New Issue
Block a user