Reformat code files.
This commit is contained in:
@@ -27,7 +27,6 @@ impl Engine {
|
||||
self.packages.push(package.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Control whether and how the `Engine` will optimize an AST after compilation.
|
||||
///
|
||||
/// Not available under the `no_optimize` feature.
|
||||
@@ -37,7 +36,6 @@ impl Engine {
|
||||
self.optimization_level = optimization_level;
|
||||
self
|
||||
}
|
||||
|
||||
/// The current optimization level.
|
||||
/// It controls whether and how the `Engine` will optimize an AST after compilation.
|
||||
///
|
||||
@@ -47,7 +45,6 @@ impl Engine {
|
||||
pub fn optimization_level(&self) -> OptimizationLevel {
|
||||
self.optimization_level
|
||||
}
|
||||
|
||||
/// Set the maximum levels of function calls allowed for a script in order to avoid
|
||||
/// infinite recursion and stack overflows.
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
@@ -56,14 +53,12 @@ impl Engine {
|
||||
self.limits.max_call_stack_depth = levels;
|
||||
self
|
||||
}
|
||||
|
||||
/// The maximum levels of function calls allowed for a script.
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[inline(always)]
|
||||
pub fn max_call_levels(&self) -> usize {
|
||||
self.limits.max_call_stack_depth
|
||||
}
|
||||
|
||||
/// Set the maximum number of operations allowed for a script to run to avoid
|
||||
/// consuming too much resources (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
@@ -76,14 +71,12 @@ impl Engine {
|
||||
};
|
||||
self
|
||||
}
|
||||
|
||||
/// The maximum number of operations allowed for a script to run (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[inline(always)]
|
||||
pub fn max_operations(&self) -> u64 {
|
||||
self.limits.max_operations
|
||||
}
|
||||
|
||||
/// Set the maximum number of imported modules allowed for a script.
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
@@ -92,7 +85,6 @@ impl Engine {
|
||||
self.limits.max_modules = modules;
|
||||
self
|
||||
}
|
||||
|
||||
/// The maximum number of imported modules allowed for a script.
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[cfg(not(feature = "no_module"))]
|
||||
@@ -100,7 +92,6 @@ impl Engine {
|
||||
pub fn max_modules(&self) -> usize {
|
||||
self.limits.max_modules
|
||||
}
|
||||
|
||||
/// Set the depth limits for expressions (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[inline(always)]
|
||||
@@ -124,14 +115,12 @@ impl Engine {
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// The depth limit for expressions (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[inline(always)]
|
||||
pub fn max_expr_depth(&self) -> usize {
|
||||
self.limits.max_expr_depth
|
||||
}
|
||||
|
||||
/// The depth limit for expressions in functions (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
@@ -139,7 +128,6 @@ impl Engine {
|
||||
pub fn max_function_expr_depth(&self) -> usize {
|
||||
self.limits.max_function_expr_depth
|
||||
}
|
||||
|
||||
/// Set the maximum length of strings (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[inline(always)]
|
||||
@@ -147,14 +135,12 @@ impl Engine {
|
||||
self.limits.max_string_size = if max_size == usize::MAX { 0 } else { max_size };
|
||||
self
|
||||
}
|
||||
|
||||
/// The maximum length of strings (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[inline(always)]
|
||||
pub fn max_string_size(&self) -> usize {
|
||||
self.limits.max_string_size
|
||||
}
|
||||
|
||||
/// Set the maximum length of arrays (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
@@ -163,7 +149,6 @@ impl Engine {
|
||||
self.limits.max_array_size = if max_size == usize::MAX { 0 } else { max_size };
|
||||
self
|
||||
}
|
||||
|
||||
/// The maximum length of arrays (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
@@ -171,7 +156,6 @@ impl Engine {
|
||||
pub fn max_array_size(&self) -> usize {
|
||||
self.limits.max_array_size
|
||||
}
|
||||
|
||||
/// Set the maximum length of object maps (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
@@ -180,7 +164,6 @@ impl Engine {
|
||||
self.limits.max_map_size = if max_size == usize::MAX { 0 } else { max_size };
|
||||
self
|
||||
}
|
||||
|
||||
/// The maximum length of object maps (0 for unlimited).
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
@@ -188,7 +171,6 @@ impl Engine {
|
||||
pub fn max_map_size(&self) -> usize {
|
||||
self.limits.max_map_size
|
||||
}
|
||||
|
||||
/// Set the module resolution service used by the `Engine`.
|
||||
///
|
||||
/// Not available under the `no_module` feature.
|
||||
@@ -201,7 +183,6 @@ impl Engine {
|
||||
self.module_resolver = resolver.map(|f| Box::new(f) as Box<dyn ModuleResolver>);
|
||||
self
|
||||
}
|
||||
|
||||
/// Disable a particular keyword or operator in the language.
|
||||
///
|
||||
/// # Examples
|
||||
@@ -243,7 +224,6 @@ impl Engine {
|
||||
self.disabled_symbols.insert(symbol.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Register a custom operator into the language.
|
||||
///
|
||||
/// The operator must be a valid identifier (i.e. it cannot be a symbol).
|
||||
|
Reference in New Issue
Block a user