Update comments with links.

This commit is contained in:
Stephen Chung
2020-11-20 16:52:28 +08:00
parent 2afcecc6ba
commit 783803ec46
40 changed files with 698 additions and 644 deletions

View File

@@ -22,7 +22,7 @@ use crate::{Engine, EvalAltResult, Module, ModuleResolver, Position, Shared};
pub struct ModuleResolversCollection(Vec<Box<dyn ModuleResolver>>);
impl ModuleResolversCollection {
/// Create a new `ModuleResolversCollection`.
/// Create a new [`ModuleResolversCollection`].
///
/// # Example
///
@@ -62,18 +62,18 @@ impl ModuleResolversCollection {
pub fn clear(&mut self) {
self.0.clear();
}
/// Is this `ModuleResolversCollection` empty?
/// Is this [`ModuleResolversCollection`] empty?
#[inline(always)]
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
/// Get the number of module resolvers in this `ModuleResolversCollection`.
/// Get the number of module resolvers in this [`ModuleResolversCollection`].
#[inline(always)]
pub fn len(&self) -> usize {
self.0.len()
}
/// Add another `ModuleResolversCollection` to the end of this collection.
/// The other `ModuleResolversCollection` is consumed.
/// Add another [`ModuleResolversCollection`] to the end of this collection.
/// The other [`ModuleResolversCollection`] is consumed.
#[inline(always)]
pub fn append(&mut self, other: Self) {
self.0.extend(other.0.into_iter());

View File

@@ -7,7 +7,8 @@ use crate::{Engine, EvalAltResult, Locked, Module, ModuleResolver, Position, Sha
///
/// Script files are cached so they are are not reloaded and recompiled in subsequent requests.
///
/// The `new_with_path` and `new_with_path_and_extension` constructor functions
/// 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`).
@@ -47,7 +48,7 @@ impl Default for FileModuleResolver {
}
impl FileModuleResolver {
/// Create a new `FileModuleResolver` with a specific base path.
/// Create a new [`FileModuleResolver`] with a specific base path.
///
/// # Example
///
@@ -67,7 +68,7 @@ impl FileModuleResolver {
Self::new_with_path_and_extension(path, "rhai")
}
/// Create a new `FileModuleResolver` with a specific base path and file extension.
/// Create a new [`FileModuleResolver`] with a specific base path and file extension.
///
/// The default extension is `.rhai`.
///
@@ -96,7 +97,7 @@ impl FileModuleResolver {
}
}
/// Create a new `FileModuleResolver` with the current directory as base path.
/// Create a new [`FileModuleResolver`] with the current directory as base path.
///
/// # Example
///

View File

@@ -22,7 +22,7 @@ use crate::{Engine, EvalAltResult, Module, ModuleResolver, Position, Shared};
pub struct StaticModuleResolver(HashMap<String, Shared<Module>>);
impl StaticModuleResolver {
/// Create a new `StaticModuleResolver`.
/// Create a new [`StaticModuleResolver`].
///
/// # Example
///
@@ -83,18 +83,18 @@ impl StaticModuleResolver {
pub fn clear(&mut self) {
self.0.clear();
}
/// Is this `StaticModuleResolver` empty?
/// Is this [`StaticModuleResolver`] empty?
#[inline(always)]
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
/// Get the number of modules in this `StaticModuleResolver`.
/// Get the number of modules in this [`StaticModuleResolver`].
#[inline(always)]
pub fn len(&self) -> usize {
self.0.len()
}
/// Merge another `StaticModuleResolver` into this.
/// The other `StaticModuleResolver` is consumed.
/// Merge another [`StaticModuleResolver`] into this.
/// The other [`StaticModuleResolver`] is consumed.
#[inline(always)]
pub fn merge(&mut self, other: Self) {
if !other.is_empty() {