Fix builds.
This commit is contained in:
parent
29a9b3878d
commit
8d67c70294
@ -1,39 +1,12 @@
|
|||||||
//! Settings for [`Engine`]'s limitations.
|
//! Settings for [`Engine`]'s limitations.
|
||||||
#![cfg(not(feature = "unchecked"))]
|
#![cfg(not(feature = "unchecked"))]
|
||||||
|
|
||||||
|
use super::default_limits;
|
||||||
use crate::Engine;
|
use crate::Engine;
|
||||||
use std::num::{NonZeroU64, NonZeroUsize};
|
use std::num::{NonZeroU64, NonZeroUsize};
|
||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
use std::prelude::v1::*;
|
use std::prelude::v1::*;
|
||||||
|
|
||||||
pub mod defaults {
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
#[cfg(not(feature = "no_function"))]
|
|
||||||
pub const MAX_CALL_STACK_DEPTH: usize = 8;
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
pub const MAX_EXPR_DEPTH: usize = 32;
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
|
||||||
#[cfg(not(feature = "no_function"))]
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
pub const MAX_FUNCTION_EXPR_DEPTH: usize = 16;
|
|
||||||
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
#[cfg(not(feature = "no_function"))]
|
|
||||||
pub const MAX_CALL_STACK_DEPTH: usize = 64;
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
pub const MAX_EXPR_DEPTH: usize = 64;
|
|
||||||
#[cfg(not(feature = "unchecked"))]
|
|
||||||
#[cfg(not(feature = "no_function"))]
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
pub const MAX_FUNCTION_EXPR_DEPTH: usize = 32;
|
|
||||||
|
|
||||||
pub const MAX_DYNAMIC_PARAMETERS: usize = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A type containing all the limits imposed by the [`Engine`].
|
/// A type containing all the limits imposed by the [`Engine`].
|
||||||
///
|
///
|
||||||
/// Not available under `unchecked`.
|
/// Not available under `unchecked`.
|
||||||
@ -84,10 +57,10 @@ impl Limits {
|
|||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
#[cfg(not(feature = "no_function"))]
|
#[cfg(not(feature = "no_function"))]
|
||||||
max_call_stack_depth: defaults::MAX_CALL_STACK_DEPTH,
|
max_call_stack_depth: default_limits::MAX_CALL_STACK_DEPTH,
|
||||||
max_expr_depth: NonZeroUsize::new(defaults::MAX_EXPR_DEPTH),
|
max_expr_depth: NonZeroUsize::new(default_limits::MAX_EXPR_DEPTH),
|
||||||
#[cfg(not(feature = "no_function"))]
|
#[cfg(not(feature = "no_function"))]
|
||||||
max_function_expr_depth: NonZeroUsize::new(defaults::MAX_FUNCTION_EXPR_DEPTH),
|
max_function_expr_depth: NonZeroUsize::new(default_limits::MAX_FUNCTION_EXPR_DEPTH),
|
||||||
max_operations: None,
|
max_operations: None,
|
||||||
#[cfg(not(feature = "no_module"))]
|
#[cfg(not(feature = "no_module"))]
|
||||||
max_modules: usize::MAX,
|
max_modules: usize::MAX,
|
||||||
|
@ -27,6 +27,34 @@ use crate::{Engine, Identifier};
|
|||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
use std::prelude::v1::*;
|
use std::prelude::v1::*;
|
||||||
|
|
||||||
|
pub mod default_limits {
|
||||||
|
#[cfg(not(feature = "unchecked"))]
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
#[cfg(not(feature = "no_function"))]
|
||||||
|
pub const MAX_CALL_STACK_DEPTH: usize = 8;
|
||||||
|
#[cfg(not(feature = "unchecked"))]
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
pub const MAX_EXPR_DEPTH: usize = 32;
|
||||||
|
#[cfg(not(feature = "unchecked"))]
|
||||||
|
#[cfg(not(feature = "no_function"))]
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
pub const MAX_FUNCTION_EXPR_DEPTH: usize = 16;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "unchecked"))]
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
#[cfg(not(feature = "no_function"))]
|
||||||
|
pub const MAX_CALL_STACK_DEPTH: usize = 64;
|
||||||
|
#[cfg(not(feature = "unchecked"))]
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
pub const MAX_EXPR_DEPTH: usize = 64;
|
||||||
|
#[cfg(not(feature = "unchecked"))]
|
||||||
|
#[cfg(not(feature = "no_function"))]
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
pub const MAX_FUNCTION_EXPR_DEPTH: usize = 32;
|
||||||
|
|
||||||
|
pub const MAX_DYNAMIC_PARAMETERS: usize = 16;
|
||||||
|
}
|
||||||
|
|
||||||
/// Script optimization API.
|
/// Script optimization API.
|
||||||
#[cfg(not(feature = "no_optimize"))]
|
#[cfg(not(feature = "no_optimize"))]
|
||||||
impl Engine {
|
impl Engine {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user