Add doc comments.
This commit is contained in:
parent
d60ed5a502
commit
809feaf58d
@ -818,12 +818,19 @@ impl EvalState {
|
|||||||
/// Context of a script evaluation process.
|
/// Context of a script evaluation process.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct EvalContext<'a, 'x, 'px, 'm, 's, 'b, 't, 'pt> {
|
pub struct EvalContext<'a, 'x, 'px, 'm, 's, 'b, 't, 'pt> {
|
||||||
|
/// The current [`Engine`].
|
||||||
pub(crate) engine: &'a Engine,
|
pub(crate) engine: &'a Engine,
|
||||||
|
/// The current [`Scope`].
|
||||||
pub(crate) scope: &'x mut Scope<'px>,
|
pub(crate) scope: &'x mut Scope<'px>,
|
||||||
|
/// The current [`GlobalRuntimeState`].
|
||||||
pub(crate) global: &'m mut GlobalRuntimeState,
|
pub(crate) global: &'m mut GlobalRuntimeState,
|
||||||
|
/// The current [evaluation state][EvalState].
|
||||||
pub(crate) state: &'s mut EvalState,
|
pub(crate) state: &'s mut EvalState,
|
||||||
|
/// The current stack of imported [modules][Module].
|
||||||
pub(crate) lib: &'b [&'b Module],
|
pub(crate) lib: &'b [&'b Module],
|
||||||
|
/// The current bound `this` pointer, if any.
|
||||||
pub(crate) this_ptr: &'t mut Option<&'pt mut Dynamic>,
|
pub(crate) this_ptr: &'t mut Option<&'pt mut Dynamic>,
|
||||||
|
/// The current nesting level of function calls.
|
||||||
pub(crate) level: usize,
|
pub(crate) level: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,11 +58,17 @@ pub type LockGuard<'a, T> = std::sync::RwLockWriteGuard<'a, T>;
|
|||||||
/// Context of a native Rust function call.
|
/// Context of a native Rust function call.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct NativeCallContext<'a> {
|
pub struct NativeCallContext<'a> {
|
||||||
|
/// The current [`Engine`].
|
||||||
engine: &'a Engine,
|
engine: &'a Engine,
|
||||||
|
/// Name of function called.
|
||||||
fn_name: &'a str,
|
fn_name: &'a str,
|
||||||
|
/// Function source, if any.
|
||||||
source: Option<&'a str>,
|
source: Option<&'a str>,
|
||||||
|
/// The current [`GlobalRuntimeState`], if any.
|
||||||
global: Option<&'a GlobalRuntimeState>,
|
global: Option<&'a GlobalRuntimeState>,
|
||||||
|
/// The current stack of loaded [modules][Module].
|
||||||
lib: &'a [&'a Module],
|
lib: &'a [&'a Module],
|
||||||
|
/// [Position] of the function call.
|
||||||
pos: Position,
|
pos: Position,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +180,7 @@ impl<'a> NativeCallContext<'a> {
|
|||||||
pub const fn fn_name(&self) -> &str {
|
pub const fn fn_name(&self) -> &str {
|
||||||
self.fn_name
|
self.fn_name
|
||||||
}
|
}
|
||||||
/// [Position][`Position`] of the function call.
|
/// [Position] of the function call.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn position(&self) -> Position {
|
pub const fn position(&self) -> Position {
|
||||||
@ -204,7 +210,7 @@ impl<'a> NativeCallContext<'a> {
|
|||||||
) -> impl Iterator<Item = (&crate::Identifier, &Shared<Module>)> {
|
) -> impl Iterator<Item = (&crate::Identifier, &Shared<Module>)> {
|
||||||
self.global.iter().flat_map(|&m| m.iter_modules_raw())
|
self.global.iter().flat_map(|&m| m.iter_modules_raw())
|
||||||
}
|
}
|
||||||
/// _(internals)_ The current [`GlobalRuntimeState`].
|
/// _(internals)_ The current [`GlobalRuntimeState`], if any.
|
||||||
/// Exported under the `internals` feature only.
|
/// Exported under the `internals` feature only.
|
||||||
///
|
///
|
||||||
/// Not available under `no_module`.
|
/// Not available under `no_module`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user