Refine doc comments.

This commit is contained in:
Stephen Chung
2021-05-10 11:07:19 +08:00
parent 2cf59e9954
commit fd19d625b0
7 changed files with 131 additions and 23 deletions

View File

@@ -39,10 +39,14 @@ pub use std::rc::Rc as Shared;
pub use std::sync::Arc as Shared;
/// Synchronized shared object.
///
/// Not available under `no_closure`.
#[cfg(not(feature = "no_closure"))]
#[cfg(not(feature = "sync"))]
pub use std::cell::RefCell as Locked;
/// Synchronized shared object.
///
/// Not available under `no_closure`.
#[cfg(not(feature = "no_closure"))]
#[cfg(feature = "sync")]
pub use std::sync::RwLock as Locked;
@@ -101,6 +105,8 @@ impl<'a> NativeCallContext<'a> {
}
/// _(INTERNALS)_ Create a new [`NativeCallContext`].
/// Exported under the `internals` feature only.
///
/// Not available under `no_module`.
#[cfg(feature = "internals")]
#[cfg(not(feature = "no_module"))]
#[inline(always)]
@@ -135,6 +141,8 @@ impl<'a> NativeCallContext<'a> {
self.source
}
/// Get an iterator over the current set of modules imported via `import` statements.
///
/// Not available under `no_module`.
#[cfg(not(feature = "no_module"))]
#[inline(always)]
pub fn iter_imports(&self) -> impl Iterator<Item = (&str, &Module)> {
@@ -151,6 +159,8 @@ impl<'a> NativeCallContext<'a> {
}
/// _(INTERNALS)_ The current set of modules imported via `import` statements.
/// Exported under the `internals` feature only.
///
/// Not available under `no_module`.
#[cfg(feature = "internals")]
#[cfg(not(feature = "no_module"))]
#[inline(always)]
@@ -303,6 +313,8 @@ impl FnPtr {
!self.1.is_empty()
}
/// Does the function pointer refer to an anonymous function?
///
/// Not available under `no_function`.
#[cfg(not(feature = "no_function"))]
#[inline(always)]
pub fn is_anonymous(&self) -> bool {
@@ -467,6 +479,8 @@ pub enum CallableFunction {
/// A plugin function,
Plugin(Shared<FnPlugin>),
/// A script-defined function.
///
/// Not available under `no_function`.
#[cfg(not(feature = "no_function"))]
Script(Shared<crate::ast::ScriptFnDef>),
}
@@ -601,6 +615,8 @@ impl CallableFunction {
}
/// Get a shared reference to a script-defined function definition.
///
/// Not available under `no_function`.
///
/// # Panics
///
/// Panics if the [`CallableFunction`] is not [`Script`][CallableFunction::Script].