From c7498503ba224e52b658270143a1e6adf43e9bfc Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sun, 25 Jul 2021 22:56:05 +0800 Subject: [PATCH] Use lower case for feature marker. --- src/ast.rs | 38 +++++++++++++++++++------------------- src/dynamic.rs | 12 ++++++------ src/engine.rs | 14 +++++++------- src/engine_api.rs | 2 +- src/error_parsing.rs | 2 +- src/fn_native.rs | 6 +++--- src/fn_register.rs | 6 +++--- src/lib.rs | 2 +- src/module/mod.rs | 8 ++++---- src/serde/metadata.rs | 2 +- src/serde/mod.rs | 2 +- src/token.rs | 18 +++++++++--------- 12 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index c9ce1d3f..bd81b4c3 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -40,7 +40,7 @@ pub enum FnAccess { Private, } -/// _(INTERNALS)_ A type containing information on a scripted function. +/// _(internals)_ A type containing information on a scripted function. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -68,7 +68,7 @@ pub struct ScriptFnDef { /// Not available under `no_closure`. #[cfg(not(feature = "no_closure"))] pub externals: std::collections::BTreeSet, - /// _(METADATA)_ Function doc-comments (if any). + /// _(metadata)_ Function doc-comments (if any). /// Exported under the `metadata` feature only. /// /// Not available under `no_function`. @@ -104,7 +104,7 @@ impl fmt::Display for ScriptFnDef { #[cfg(not(feature = "no_function"))] #[derive(Debug, Eq, PartialEq, Clone, Hash)] pub struct ScriptFnMetadata<'a> { - /// _(METADATA)_ Function doc-comments (if any). + /// _(metadata)_ Function doc-comments (if any). /// Exported under the `metadata` feature only. /// /// Not available under `no_function`. @@ -278,7 +278,7 @@ impl AST { pub(crate) fn statements(&self) -> &[Stmt] { &self.body.0 } - /// _(INTERNALS)_ Get the statements. + /// _(internals)_ Get the statements. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] #[deprecated = "this method is volatile and may change"] @@ -303,7 +303,7 @@ impl AST { pub(crate) fn shared_lib(&self) -> Shared { self.functions.clone() } - /// _(INTERNALS)_ Get the internal shared [`Module`] containing all script-defined functions. + /// _(internals)_ Get the internal shared [`Module`] containing all script-defined functions. /// Exported under the `internals` feature only. /// /// Not available under `no_function` or `no_module`. @@ -323,7 +323,7 @@ impl AST { pub(crate) fn lib(&self) -> &Module { &self.functions } - /// _(INTERNALS)_ Get the internal [`Module`] containing all script-defined functions. + /// _(internals)_ Get the internal [`Module`] containing all script-defined functions. /// Exported under the `internals` feature only. /// /// Not available under `no_function`. @@ -344,7 +344,7 @@ impl AST { ) -> Option> { self.resolver.clone() } - /// _(INTERNALS)_ Get the embedded [module resolver][crate::ModuleResolver]. + /// _(internals)_ Get the embedded [module resolver][crate::ModuleResolver]. /// Exported under the `internals` feature only. /// /// Not available under `no_module`. @@ -762,7 +762,7 @@ impl AST { true } - /// _(INTERNALS)_ Recursively walk the [`AST`], including function bodies (if any). + /// _(internals)_ Recursively walk the [`AST`], including function bodies (if any). /// Return `false` from the callback to terminate the walk. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] @@ -816,7 +816,7 @@ impl AsRef for AST { } } -/// _(INTERNALS)_ An identifier containing a name and a [position][Position]. +/// _(internals)_ An identifier containing a name and a [position][Position]. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -837,7 +837,7 @@ impl fmt::Debug for Ident { } } -/// _(INTERNALS)_ A type encapsulating the mode of a `return`/`throw` statement. +/// _(internals)_ A type encapsulating the mode of a `return`/`throw` statement. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -851,7 +851,7 @@ pub enum ReturnType { Exception, } -/// _(INTERNALS)_ An [`AST`] node, consisting of either an [`Expr`] or a [`Stmt`]. +/// _(internals)_ An [`AST`] node, consisting of either an [`Expr`] or a [`Stmt`]. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -875,7 +875,7 @@ impl<'a> From<&'a Expr> for ASTNode<'a> { } } -/// _(INTERNALS)_ A statements block. +/// _(internals)_ A statements block. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -950,7 +950,7 @@ impl From for Stmt { } } -/// _(INTERNALS)_ A statement. +/// _(internals)_ A statement. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -1375,7 +1375,7 @@ impl Stmt { } } -/// _(INTERNALS)_ A custom syntax expression. +/// _(internals)_ A custom syntax expression. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -1391,7 +1391,7 @@ pub struct CustomExpr { pub tokens: StaticVec, } -/// _(INTERNALS)_ A binary expression. +/// _(internals)_ A binary expression. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -1405,7 +1405,7 @@ pub struct BinaryExpr { pub rhs: Expr, } -/// _(INTERNALS)_ An op-assignment operator. +/// _(internals)_ An op-assignment operator. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -1443,7 +1443,7 @@ impl OpAssignment<'_> { } } -/// _(INTERNALS)_ An set of function call hashes. +/// _(internals)_ An set of function call hashes. /// Exported under the `internals` feature only. /// /// Two separate hashes are pre-calculated because of the following pattern: @@ -1530,7 +1530,7 @@ impl FnCallHashes { } } -/// _(INTERNALS)_ A function call. +/// _(internals)_ A function call. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -1686,7 +1686,7 @@ impl FloatWrapper { } } -/// _(INTERNALS)_ An expression sub-tree. +/// _(internals)_ An expression sub-tree. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure diff --git a/src/dynamic.rs b/src/dynamic.rs index 0fc5c4d9..8441a940 100644 --- a/src/dynamic.rs +++ b/src/dynamic.rs @@ -46,7 +46,7 @@ mod private { impl Sealed for T {} } -/// _(INTERNALS)_ Trait to represent any type. +/// _(internals)_ Trait to represent any type. /// Exported under the `internals` feature only. /// /// This trait is sealed and cannot be implemented. @@ -80,7 +80,7 @@ pub trait Variant: Any + private::Sealed { fn clone_into_dynamic(&self) -> Dynamic; } -/// _(INTERNALS)_ Trait to represent any type. +/// _(internals)_ Trait to represent any type. /// Exported under the `internals` feature only. /// /// This trait is sealed and cannot be implemented. @@ -189,7 +189,7 @@ pub enum Union { /// Not available under `no_float`. #[cfg(not(feature = "no_float"))] Float(FloatWrapper, Tag, AccessMode), - /// _(DECIMAL)_ A fixed-precision decimal value. + /// _(decimal)_ A fixed-precision decimal value. /// Exported under the `decimal` feature only. #[cfg(feature = "decimal")] Decimal(Box, Tag, AccessMode), @@ -222,7 +222,7 @@ pub enum Union { Shared(crate::Shared>, Tag, AccessMode), } -/// _(INTERNALS)_ Lock guard for reading a [`Dynamic`]. +/// _(internals)_ Lock guard for reading a [`Dynamic`]. /// Exported under the `internals` feature only. /// /// This type provides transparent interoperability between normal [`Dynamic`] and shared @@ -265,7 +265,7 @@ impl<'d, T: Any + Clone> Deref for DynamicReadLock<'d, T> { } } -/// _(INTERNALS)_ Lock guard for writing a [`Dynamic`]. +/// _(internals)_ Lock guard for writing a [`Dynamic`]. /// Exported under the `internals` feature only. /// /// This type provides transparent interoperability between normal [`Dynamic`] and shared @@ -1762,7 +1762,7 @@ impl Dynamic { _ => Err(self.type_name()), } } - /// _(DECIMAL)_ Cast the [`Dynamic`] as a [`Decimal`](https://docs.rs/rust_decimal) and return it. + /// _(decimal)_ Cast the [`Dynamic`] as a [`Decimal`](https://docs.rs/rust_decimal) and return it. /// Returns the name of the actual type if the cast fails. /// /// Exported under the `decimal` feature only. diff --git a/src/engine.rs b/src/engine.rs index 75924308..3977e517 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -40,7 +40,7 @@ use crate::ast::FnCallHashes; pub type Precedence = NonZeroU8; -/// _(INTERNALS)_ A stack of imported [modules][Module]. +/// _(internals)_ A stack of imported [modules][Module]. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -620,7 +620,7 @@ impl> From for Target<'_> { } } -/// _(INTERNALS)_ An entry in a function resolution cache. +/// _(internals)_ An entry in a function resolution cache. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -634,7 +634,7 @@ pub struct FnResolutionCacheEntry { pub source: Option, } -/// _(INTERNALS)_ A function resolution cache. +/// _(internals)_ A function resolution cache. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -642,7 +642,7 @@ pub struct FnResolutionCacheEntry { /// This type is volatile and may change. pub type FnResolutionCache = BTreeMap>>; -/// _(INTERNALS)_ A type that holds all the current states of the [`Engine`]. +/// _(internals)_ A type that holds all the current states of the [`Engine`]. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -723,7 +723,7 @@ impl EvalState { } } -/// _(INTERNALS)_ A type containing all the limits imposed by the [`Engine`]. +/// _(internals)_ A type containing all the limits imposed by the [`Engine`]. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -833,7 +833,7 @@ impl<'x, 'px, 'pt> EvalContext<'_, 'x, 'px, '_, '_, '_, '_, 'pt> { pub fn iter_imports(&self) -> impl Iterator { self.mods.iter() } - /// _(INTERNALS)_ The current set of modules imported via `import` statements. + /// _(internals)_ The current set of modules imported via `import` statements. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] #[cfg(not(feature = "no_module"))] @@ -847,7 +847,7 @@ impl<'x, 'px, 'pt> EvalContext<'_, 'x, 'px, '_, '_, '_, '_, 'pt> { pub fn iter_namespaces(&self) -> impl Iterator { self.lib.iter().cloned() } - /// _(INTERNALS)_ The current set of namespaces containing definitions of all script-defined functions. + /// _(internals)_ The current set of namespaces containing definitions of all script-defined functions. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] #[inline(always)] diff --git a/src/engine_api.rs b/src/engine_api.rs index d61c4074..6e50cfee 100644 --- a/src/engine_api.rs +++ b/src/engine_api.rs @@ -2052,7 +2052,7 @@ impl Engine { let stmt = std::mem::take(ast.statements_mut()); crate::optimize::optimize_into_ast(self, scope, stmt.into_vec(), lib, optimization_level) } - /// _(METADATA)_ Generate a list of all registered functions. + /// _(metadata)_ Generate a list of all registered functions. /// Exported under the `metadata` feature only. /// /// Functions from the following sources are included, in order: diff --git a/src/error_parsing.rs b/src/error_parsing.rs index c65b9b07..396c7957 100644 --- a/src/error_parsing.rs +++ b/src/error_parsing.rs @@ -9,7 +9,7 @@ use std::fmt; #[cfg(feature = "no_std")] use std::prelude::v1::*; -/// _(INTERNALS)_ Error encountered when tokenizing the script text. +/// _(internals)_ Error encountered when tokenizing the script text. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure diff --git a/src/fn_native.rs b/src/fn_native.rs index 9930fec4..c7d8cdbd 100644 --- a/src/fn_native.rs +++ b/src/fn_native.rs @@ -98,7 +98,7 @@ impl<'a> NativeCallContext<'a> { lib, } } - /// _(INTERNALS)_ Create a new [`NativeCallContext`]. + /// _(internals)_ Create a new [`NativeCallContext`]. /// Exported under the `internals` feature only. /// /// Not available under `no_module`. @@ -156,7 +156,7 @@ impl<'a> NativeCallContext<'a> { ) -> impl Iterator)> { self.mods.iter().flat_map(|&m| m.iter_raw()) } - /// _(INTERNALS)_ The current set of modules imported via `import` statements. + /// _(internals)_ The current set of modules imported via `import` statements. /// Exported under the `internals` feature only. /// /// Not available under `no_module`. @@ -172,7 +172,7 @@ impl<'a> NativeCallContext<'a> { pub fn iter_namespaces(&self) -> impl Iterator { self.lib.iter().cloned() } - /// _(INTERNALS)_ The current set of namespaces containing definitions of all script-defined functions. + /// _(internals)_ The current set of namespaces containing definitions of all script-defined functions. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] #[inline(always)] diff --git a/src/fn_register.rs b/src/fn_register.rs index b74a93ce..cb90c62e 100644 --- a/src/fn_register.rs +++ b/src/fn_register.rs @@ -71,17 +71,17 @@ pub trait RegisterNativeFunction { /// Get the type ID's of this function's parameters. #[must_use] fn param_types() -> Box<[TypeId]>; - /// _(METADATA)_ Get the type names of this function's parameters. + /// _(metadata)_ Get the type names of this function's parameters. /// Exported under the `metadata` feature only. #[cfg(feature = "metadata")] #[must_use] fn param_names() -> Box<[&'static str]>; - /// _(METADATA)_ Get the type ID of this function's return value. + /// _(metadata)_ Get the type ID of this function's return value. /// Exported under the `metadata` feature only. #[cfg(feature = "metadata")] #[must_use] fn return_type() -> TypeId; - /// _(METADATA)_ Get the type name of this function's return value. + /// _(metadata)_ Get the type name of this function's return value. /// Exported under the `metadata` feature only. #[cfg(feature = "metadata")] #[must_use] diff --git a/src/lib.rs b/src/lib.rs index 6b13fac0..9be39b92 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -278,7 +278,7 @@ pub use module::NamespaceRef; #[cfg(not(feature = "internals"))] type StaticVec = smallvec::SmallVec<[T; 4]>; -/// _(INTERNALS)_ Alias to [`smallvec`](https://crates.io/crates/smallvec), which is a specialized +/// _(internals)_ Alias to [`smallvec`](https://crates.io/crates/smallvec), which is a specialized /// [`Vec`] backed by a small, inline, fixed-size array when there are ≤ 4 items stored. /// Exported under the `internals` feature only. /// diff --git a/src/module/mod.rs b/src/module/mod.rs index 413fad22..041dbafa 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -102,7 +102,7 @@ impl FuncInfo { } } -/// _(INTERNALS)_ Calculate a [`u64`] hash key from a namespace-qualified function name and +/// _(internals)_ Calculate a [`u64`] hash key from a namespace-qualified function name and /// parameter types. /// Exported under the `internals` feature only. /// @@ -1364,7 +1364,7 @@ impl Module { .map(|f| (f.namespace, f.access, f.name.as_str(), f.params)) } - /// _(INTERNALS)_ Get an iterator over all script-defined functions in the [`Module`]. + /// _(internals)_ Get an iterator over all script-defined functions in the [`Module`]. /// Exported under the `internals` feature only. /// /// Function metadata includes: @@ -1372,7 +1372,7 @@ impl Module { /// 2) Access mode ([`FnAccess::Public`] or [`FnAccess::Private`]). /// 3) Function name (as string slice). /// 4) Number of parameters. - /// 5) _(INTERNALS)_ Shared reference to function definition [`ScriptFnDef`][crate::ast::ScriptFnDef]. + /// 5) _(internals)_ Shared reference to function definition [`ScriptFnDef`][crate::ast::ScriptFnDef]. #[cfg(not(feature = "no_function"))] #[cfg(feature = "internals")] #[inline(always)] @@ -1653,7 +1653,7 @@ impl Module { } } -/// _(INTERNALS)_ A chain of [module][Module] names to namespace-qualify a variable or function call. +/// _(internals)_ A chain of [module][Module] names to namespace-qualify a variable or function call. /// Exported under the `internals` feature only. /// /// A [`u64`] offset to the current [`Scope`][crate::Scope] is cached for quick search purposes. diff --git a/src/serde/metadata.rs b/src/serde/metadata.rs index 31e04aee..63961baa 100644 --- a/src/serde/metadata.rs +++ b/src/serde/metadata.rs @@ -209,7 +209,7 @@ impl From<&crate::Module> for ModuleMetadata { #[cfg(feature = "metadata")] impl Engine { - /// _(METADATA)_ Generate a list of all functions (including those defined in an + /// _(metadata)_ Generate a list of all functions (including those defined in an /// [`AST`][crate::AST]) in JSON format. /// Exported under the `metadata` feature only. /// diff --git a/src/serde/mod.rs b/src/serde/mod.rs index a3819556..f391d694 100644 --- a/src/serde/mod.rs +++ b/src/serde/mod.rs @@ -1,4 +1,4 @@ -//! _(SERDE)_ Serialization and deserialization support for [`serde`](https://crates.io/crates/serde). +//! _(serde)_ Serialization and deserialization support for [`serde`](https://crates.io/crates/serde). //! Exported under the `serde` feature only. mod de; diff --git a/src/token.rs b/src/token.rs index 4dcaec9a..2b76166b 100644 --- a/src/token.rs +++ b/src/token.rs @@ -27,7 +27,7 @@ use rust_decimal::Decimal; #[cfg(not(feature = "no_function"))] use crate::engine::KEYWORD_IS_DEF_FN; -/// _(INTERNALS)_ A type containing commands to control the tokenizer. +/// _(internals)_ A type containing commands to control the tokenizer. #[derive(Debug, Clone, Eq, PartialEq, Hash, Copy, Default)] pub struct TokenizerControlBlock { /// Is the current tokenizer position within an interpolated text string? @@ -35,7 +35,7 @@ pub struct TokenizerControlBlock { pub is_within_text: bool, } -/// _(INTERNALS)_ A shared object that allows control of the tokenizer from outside. +/// _(internals)_ A shared object that allows control of the tokenizer from outside. pub type TokenizerControl = Rc>; type LERR = LexError; @@ -283,7 +283,7 @@ impl AddAssign for Position { } } -/// _(INTERNALS)_ A Rhai language token. +/// _(internals)_ A Rhai language token. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -980,7 +980,7 @@ impl From for String { } } -/// _(INTERNALS)_ State of the tokenizer. +/// _(internals)_ State of the tokenizer. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -1000,7 +1000,7 @@ pub struct TokenizeState { pub is_within_text_terminated_by: Option, } -/// _(INTERNALS)_ Trait that encapsulates a peekable character input stream. +/// _(internals)_ Trait that encapsulates a peekable character input stream. /// Exported under the `internals` feature only. /// /// # Volatile Data Structure @@ -1018,7 +1018,7 @@ pub trait InputStream { fn peek_next(&mut self) -> Option; } -/// _(INTERNALS)_ Parse a string literal ended by `termination_char`. +/// _(internals)_ Parse a string literal ended by `termination_char`. /// Exported under the `internals` feature only. /// /// Returns the parsed string and a boolean indicating whether the string is @@ -1310,7 +1310,7 @@ fn scan_block_comment( level } -/// _(INTERNALS)_ Get the next token from the `stream`. +/// _(internals)_ Get the next token from the `stream`. /// Exported under the `internals` feature only. /// /// # Volatile API @@ -2234,7 +2234,7 @@ impl<'a> Iterator for TokenIterator<'a> { impl FusedIterator for TokenIterator<'_> {} impl Engine { - /// _(INTERNALS)_ Tokenize an input text stream. + /// _(internals)_ Tokenize an input text stream. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] #[inline(always)] @@ -2245,7 +2245,7 @@ impl Engine { ) -> (TokenIterator<'a>, TokenizerControl) { self.lex_raw(input, None) } - /// _(INTERNALS)_ Tokenize an input text stream with a mapping function. + /// _(internals)_ Tokenize an input text stream with a mapping function. /// Exported under the `internals` feature only. #[cfg(feature = "internals")] #[inline(always)]