Check for missing docs.

This commit is contained in:
Stephen Chung 2022-06-05 18:17:44 +08:00
parent 0a9457a13d
commit 6ebe002b18
8 changed files with 38 additions and 19 deletions

View File

@ -22,7 +22,7 @@ ahash = { version = "0.7", default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
bitflags = { version = "1", default-features = false } bitflags = { version = "1", default-features = false }
smartstring = { version = "1", default-features = false } smartstring = { version = "1", default-features = false }
rhai_codegen = { version = "1.4", path = "codegen", default-features = false } rhai_codegen = { version = "1.4.1", path = "codegen", default-features = false }
no-std-compat = { version = "0.4", default-features = false, features = ["alloc"], optional = true } no-std-compat = { version = "0.4", default-features = false, features = ["alloc"], optional = true }
libm = { version = "0.2", default-features = false, optional = true } libm = { version = "0.2", default-features = false, optional = true }

View File

@ -34,15 +34,15 @@ pub type OnDebuggerCallback = dyn Fn(EvalContext, DebuggerEvent, ASTNode, Option
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[non_exhaustive] #[non_exhaustive]
pub enum DebuggerCommand { pub enum DebuggerCommand {
// Continue normal execution. /// Continue normal execution.
Continue, Continue,
// Step into the next expression, diving into functions. /// Step into the next expression, diving into functions.
StepInto, StepInto,
// Run to the next expression or statement, stepping over functions. /// Run to the next expression or statement, stepping over functions.
StepOver, StepOver,
// Run to the next statement, skipping over functions. /// Run to the next statement, skipping over functions.
Next, Next,
// Run to the end of the current function call. /// Run to the end of the current function call.
FunctionExit, FunctionExit,
} }
@ -78,17 +78,17 @@ impl DebuggerStatus {
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
#[non_exhaustive] #[non_exhaustive]
pub enum DebuggerEvent<'a> { pub enum DebuggerEvent<'a> {
// Script evaluation starts. /// Script evaluation starts.
Start, Start,
// Break on next step. /// Break on next step.
Step, Step,
// Break on break-point. /// Break on break-point.
BreakPoint(usize), BreakPoint(usize),
// Return from a function with a value. /// Return from a function with a value.
FunctionExitWithValue(&'a Dynamic), FunctionExitWithValue(&'a Dynamic),
// Return from a function with a value. /// Return from a function with a value.
FunctionExitWithError(&'a EvalAltResult), FunctionExitWithError(&'a EvalAltResult),
// Script evaluation ends. /// Script evaluation ends.
End, End,
} }
@ -103,23 +103,39 @@ pub enum BreakPoint {
/// Source is empty if not available. /// Source is empty if not available.
#[cfg(not(feature = "no_position"))] #[cfg(not(feature = "no_position"))]
AtPosition { AtPosition {
/// Source (empty if not available) of the break-point.
source: Identifier, source: Identifier,
/// [Position] of the break-point.
pos: Position, pos: Position,
/// Is the break-point enabled?
enabled: bool, enabled: bool,
}, },
/// Break at a particular function call. /// Break at a particular function call.
AtFunctionName { name: Identifier, enabled: bool }, AtFunctionName {
/// Function name.
name: Identifier,
/// Is the break-point enabled?
enabled: bool,
},
/// Break at a particular function call with a particular number of arguments. /// Break at a particular function call with a particular number of arguments.
AtFunctionCall { AtFunctionCall {
/// Function name.
name: Identifier, name: Identifier,
/// Number of arguments.
args: usize, args: usize,
/// Is the break-point enabled?
enabled: bool, enabled: bool,
}, },
/// Break at a particular property . /// Break at a particular property .
/// ///
/// Not available under `no_object`. /// Not available under `no_object`.
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
AtProperty { name: Identifier, enabled: bool }, AtProperty {
/// Property name.
name: Identifier,
/// Is the break-point enabled?
enabled: bool,
},
} }
impl fmt::Display for BreakPoint { impl fmt::Display for BreakPoint {

View File

@ -13,6 +13,7 @@ use std::prelude::v1::*;
/// ///
/// Not available under `no_function`. /// Not available under `no_function`.
pub trait Func<ARGS, RET> { pub trait Func<ARGS, RET> {
/// The closure's output type.
type Output; type Output;
/// Create a Rust closure from an [`AST`]. /// Create a Rust closure from an [`AST`].

View File

@ -10,6 +10,7 @@ pub use crate::{
use std::prelude::v1::*; use std::prelude::v1::*;
pub use std::{any::TypeId, mem}; pub use std::{any::TypeId, mem};
/// Result of a Rhai function.
pub type RhaiResult = crate::RhaiResult; pub type RhaiResult = crate::RhaiResult;
#[cfg(not(features = "no_module"))] #[cfg(not(features = "no_module"))]

View File

@ -57,6 +57,7 @@
//! See [The Rhai Book](https://rhai.rs/book) for details on the Rhai scripting engine and language. //! See [The Rhai Book](https://rhai.rs/book) for details on the Rhai scripting engine and language.
#![cfg_attr(feature = "no_std", no_std)] #![cfg_attr(feature = "no_std", no_std)]
#![deny(missing_docs)]
#[cfg(feature = "no_std")] #[cfg(feature = "no_std")]
extern crate alloc; extern crate alloc;

View File

@ -97,6 +97,7 @@ macro_rules! def_package {
} }
impl $package { impl $package {
#[doc=concat!("Create a new `", stringify!($package), "`")]
pub fn new() -> Self { pub fn new() -> Self {
let mut module = $crate::Module::new(); let mut module = $crate::Module::new();
<Self as $crate::packages::Package>::init(&mut module); <Self as $crate::packages::Package>::init(&mut module);

View File

@ -292,6 +292,7 @@ pub struct Span {
} }
impl Span { impl Span {
/// Empty [`Span`].
pub const NONE: Self = Self::new(Position::NONE, Position::NONE); pub const NONE: Self = Self::new(Position::NONE, Position::NONE);
/// Create a new [`Span`]. /// Create a new [`Span`].
@ -862,15 +863,15 @@ impl Token {
}) })
} }
// Is this token [`EOF`][Token::EOF]? /// Is this token [`EOF`][Token::EOF]?
#[inline(always)] #[inline(always)]
#[must_use] #[must_use]
pub const fn is_eof(&self) -> bool { pub const fn is_eof(&self) -> bool {
matches!(self, Self::EOF) matches!(self, Self::EOF)
} }
// If another operator is after these, it's probably an unary operator /// If another operator is after these, it's probably a unary operator
// (not sure about `fn` name). /// (not sure about `fn` name).
#[must_use] #[must_use]
pub const fn is_next_unary(&self) -> bool { pub const fn is_next_unary(&self) -> bool {
use Token::*; use Token::*;

View File

@ -121,8 +121,6 @@ fn test_plugins_package() -> Result<(), Box<EvalAltResult>> {
fn test_plugins_parameters() -> Result<(), Box<EvalAltResult>> { fn test_plugins_parameters() -> Result<(), Box<EvalAltResult>> {
#[export_module] #[export_module]
mod rhai_std { mod rhai_std {
use rhai::*;
pub fn noop(_: &str) {} pub fn noop(_: &str) {}
} }