Rename set_doc_comments to enable_doc_comments.
This commit is contained in:
parent
cef61bc924
commit
903b6d6795
@ -13,6 +13,7 @@ Breaking changes
|
|||||||
|
|
||||||
* Rust compiler requirement raised to 1.49.
|
* Rust compiler requirement raised to 1.49.
|
||||||
* `NativeCallContext::new` taker an additional parameter containing the name of the function called.
|
* `NativeCallContext::new` taker an additional parameter containing the name of the function called.
|
||||||
|
* `Engine::set_doc_comments` is renamed `Engine::enable_doc_comments`.
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
---------
|
---------
|
||||||
|
@ -545,32 +545,37 @@ impl State {
|
|||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct Limits {
|
pub struct Limits {
|
||||||
/// Maximum levels of call-stack to prevent infinite recursion.
|
/// Maximum levels of call-stack to prevent infinite recursion.
|
||||||
/// Not available under `no_function`.
|
|
||||||
///
|
///
|
||||||
/// Set to zero to effectively disable function calls.
|
/// Set to zero to effectively disable function calls.
|
||||||
|
///
|
||||||
|
/// Not available under `no_function`.
|
||||||
#[cfg(not(feature = "no_function"))]
|
#[cfg(not(feature = "no_function"))]
|
||||||
pub max_call_stack_depth: usize,
|
pub max_call_stack_depth: usize,
|
||||||
/// Maximum depth of statements/expressions at global level.
|
/// Maximum depth of statements/expressions at global level.
|
||||||
pub max_expr_depth: Option<NonZeroUsize>,
|
pub max_expr_depth: Option<NonZeroUsize>,
|
||||||
/// Maximum depth of statements/expressions in functions.
|
/// Maximum depth of statements/expressions in functions.
|
||||||
|
///
|
||||||
/// Not available under `no_function`.
|
/// Not available under `no_function`.
|
||||||
#[cfg(not(feature = "no_function"))]
|
#[cfg(not(feature = "no_function"))]
|
||||||
pub max_function_expr_depth: Option<NonZeroUsize>,
|
pub max_function_expr_depth: Option<NonZeroUsize>,
|
||||||
/// Maximum number of operations allowed to run.
|
/// Maximum number of operations allowed to run.
|
||||||
pub max_operations: Option<NonZeroU64>,
|
pub max_operations: Option<NonZeroU64>,
|
||||||
/// Maximum number of [modules][Module] allowed to load.
|
/// Maximum number of [modules][Module] allowed to load.
|
||||||
/// Not available under `no_module`.
|
|
||||||
///
|
///
|
||||||
/// Set to zero to effectively disable loading any [module][Module].
|
/// Set to zero to effectively disable loading any [module][Module].
|
||||||
|
///
|
||||||
|
/// Not available under `no_module`.
|
||||||
#[cfg(not(feature = "no_module"))]
|
#[cfg(not(feature = "no_module"))]
|
||||||
pub max_modules: usize,
|
pub max_modules: usize,
|
||||||
/// Maximum length of a [string][ImmutableString].
|
/// Maximum length of a [string][ImmutableString].
|
||||||
pub max_string_size: Option<NonZeroUsize>,
|
pub max_string_size: Option<NonZeroUsize>,
|
||||||
/// Maximum length of an [array][Array].
|
/// Maximum length of an [array][Array].
|
||||||
|
///
|
||||||
/// Not available under `no_index`.
|
/// Not available under `no_index`.
|
||||||
#[cfg(not(feature = "no_index"))]
|
#[cfg(not(feature = "no_index"))]
|
||||||
pub max_array_size: Option<NonZeroUsize>,
|
pub max_array_size: Option<NonZeroUsize>,
|
||||||
/// Maximum number of properties in an [object map][Map].
|
/// Maximum number of properties in an [object map][Map].
|
||||||
|
///
|
||||||
/// Not available under `no_object`.
|
/// Not available under `no_object`.
|
||||||
#[cfg(not(feature = "no_object"))]
|
#[cfg(not(feature = "no_object"))]
|
||||||
pub max_map_size: Option<NonZeroUsize>,
|
pub max_map_size: Option<NonZeroUsize>,
|
||||||
|
@ -34,7 +34,7 @@ impl Engine {
|
|||||||
}
|
}
|
||||||
/// Enable/disable doc-comments.
|
/// Enable/disable doc-comments.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn set_doc_comments(&mut self, enable: bool) -> &mut Self {
|
pub fn enable_doc_comments(&mut self, enable: bool) -> &mut Self {
|
||||||
self.disable_doc_comments = !enable;
|
self.disable_doc_comments = !enable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ use crate::stdlib::{boxed::Box, string::ToString};
|
|||||||
use crate::{Engine, EvalAltResult, ParseError, Scope, AST};
|
use crate::{Engine, EvalAltResult, ParseError, Scope, AST};
|
||||||
|
|
||||||
/// Trait to create a Rust closure from a script.
|
/// Trait to create a Rust closure from a script.
|
||||||
|
///
|
||||||
/// Not available under `no_function`.
|
/// Not available under `no_function`.
|
||||||
pub trait Func<ARGS, RET> {
|
pub trait Func<ARGS, RET> {
|
||||||
type Output;
|
type Output;
|
||||||
|
@ -12,10 +12,10 @@ fn test_comments() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r#"
|
r#"
|
||||||
let /* I am a
|
let /* I am a
|
||||||
multi-line
|
multi-line
|
||||||
comment, yay!
|
comment, yay!
|
||||||
*/ x = 42; x
|
*/ x = 42; x
|
||||||
"#
|
"#
|
||||||
)?,
|
)?,
|
||||||
42
|
42
|
||||||
@ -88,7 +88,7 @@ fn test_comments_doc() -> Result<(), Box<EvalAltResult>> {
|
|||||||
)
|
)
|
||||||
.is_err());
|
.is_err());
|
||||||
|
|
||||||
engine.set_doc_comments(false);
|
engine.enable_doc_comments(false);
|
||||||
|
|
||||||
engine.compile(
|
engine.compile(
|
||||||
r"
|
r"
|
||||||
|
Loading…
Reference in New Issue
Block a user