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 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 Breaking changes
---------------- ----------------

View File

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

View File

@ -449,14 +449,14 @@ impl<'a> Scope<'a> {
/// ///
/// let mut iter = my_scope.iter(); /// 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_eq!(name, "x");
/// assert!(!constant); /// assert!(!is_constant);
/// assert_eq!(value.cast::<i64>(), 42); /// 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_eq!(name, "foo");
/// assert!(constant); /// assert!(is_constant);
/// assert_eq!(value.cast::<String>(), "hello"); /// assert_eq!(value.cast::<String>(), "hello");
/// ``` /// ```
#[inline(always)] #[inline(always)]
@ -467,7 +467,7 @@ impl<'a> Scope<'a> {
/// Get an iterator to entries in the [`Scope`]. /// Get an iterator to entries in the [`Scope`].
/// Shared values are not expanded. /// Shared values are not expanded.
#[inline(always)] #[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 self.names
.iter() .iter()
.zip(self.values.iter()) .zip(self.values.iter())