Refine docs.

This commit is contained in:
Stephen Chung 2021-02-09 14:22:55 +08:00
parent 2dd5aceb1d
commit 88b01d6aba
3 changed files with 15 additions and 9 deletions

View File

@ -4,6 +4,12 @@ Rhai Release Notes
Version 0.19.12
===============
Bug fixes
---------
* Empty statements (i.e. statements with only one `;`) now parse correctly and no longer hang.
* `continue`, `break` and `return` statements no longer panic inside a `try .. catch` block.
Breaking changes
----------------

View File

@ -374,7 +374,7 @@ impl Module {
/// Generate signatures for all the functions in the [`Module`].
#[inline(always)]
pub fn gen_fn_signatures<'a>(&'a self) -> impl Iterator<Item = String> + 'a {
pub fn gen_fn_signatures(&self) -> impl Iterator<Item = String> + '_ {
self.functions
.values()
.filter(|FuncInfo { access, .. }| !access.is_private())
@ -1691,9 +1691,9 @@ impl Module {
/// 5) Shared reference to function definition [`ScriptFnDef`][crate::ast::ScriptFnDef].
#[cfg(not(feature = "no_function"))]
#[inline(always)]
pub(crate) fn iter_script_fn<'a>(
&'a self,
) -> impl Iterator<Item = (FnNamespace, FnAccess, &str, usize, &ScriptFnDef)> + 'a {
pub(crate) fn iter_script_fn(
&self,
) -> impl Iterator<Item = (FnNamespace, FnAccess, &str, usize, &ScriptFnDef)> + '_ {
self.functions.values().filter(|f| f.func.is_script()).map(
|FuncInfo {
namespace,

View File

@ -449,14 +449,14 @@ impl<'a> Scope<'a> {
///
/// let mut iter = my_scope.iter();
///
/// let (name, constant, value) = iter.next().unwrap();
/// let (name, is_constant, value) = iter.next().unwrap();
/// assert_eq!(name, "x");
/// assert!(!constant);
/// assert!(!is_constant);
/// assert_eq!(value.cast::<i64>(), 42);
///
/// let (name, constant, value) = iter.next().unwrap();
/// let (name, is_constant, value) = iter.next().unwrap();
/// assert_eq!(name, "foo");
/// assert!(constant);
/// assert!(is_constant);
/// assert_eq!(value.cast::<String>(), "hello");
/// ```
#[inline(always)]
@ -467,7 +467,7 @@ impl<'a> Scope<'a> {
/// Get an iterator to entries in the [`Scope`].
/// Shared values are not expanded.
#[inline(always)]
pub fn iter_raw<'x: 'a>(&'x self) -> impl Iterator<Item = (&'a str, bool, &'x Dynamic)> + 'x {
pub fn iter_raw(&self) -> impl Iterator<Item = (&str, bool, &Dynamic)> {
self.names
.iter()
.zip(self.values.iter())