Refine documentation and comments.

This commit is contained in:
Stephen Chung
2021-01-11 23:09:33 +08:00
parent 5b9a18f5b8
commit 8c47d61456
10 changed files with 65 additions and 54 deletions

View File

@@ -50,7 +50,7 @@ pub trait Package {
}
}
/// Macro that makes it easy to define a _package_ (which is basically a shared module)
/// Macro that makes it easy to define a _package_ (which is basically a shared [module][Module])
/// and register functions into it.
///
/// Functions can be added to the package using the standard module methods such as
@@ -58,6 +58,8 @@ pub trait Package {
///
/// # Example
///
/// Define a package named `MyPackage` with a single function named `my_add`:
///
/// ```
/// use rhai::{Dynamic, EvalAltResult};
/// use rhai::def_package;
@@ -70,8 +72,6 @@ pub trait Package {
/// lib.set_fn_2("my_add", add);
/// });
/// ```
///
/// The above defines a package named 'MyPackage' with a single function named 'my_add'.
#[macro_export]
macro_rules! def_package {
($root:ident : $package:ident : $comment:expr , $lib:ident , $block:stmt) => {