pub struct ExecutionLimits {
pub max_loop_iterations_per_bar: u64,
pub max_security_depth: usize,
pub max_security_calls: usize,
}Expand description
Configures runtime execution limits for the VM.
These limits protect against runaway scripts (e.g. infinite loops) that
could otherwise hang the host process. All limits are enforced per bar
(each call to Instance::run() resets
the counters).
§Examples
use openpine_vm::ExecutionLimits;
// Use defaults (500 000 loop iterations per bar)
let limits = ExecutionLimits::default();
assert_eq!(limits.max_loop_iterations_per_bar, 500_000);
// Custom limits
let limits = ExecutionLimits::default().with_max_loop_iterations_per_bar(1_000_000);Fields§
§max_loop_iterations_per_bar: u64Maximum total loop iterations allowed per bar.
All for, while, and for..in loops share this budget within a
single bar execution. When the limit is reached the VM raises a
runtime error.
Set to u64::MAX to effectively disable the limit.
max_security_depth: usizeMaximum nesting depth for request.security() calls.
The main chart has depth 0; each nested request.security() expression
increments the depth by one. A depth limit of 3 means a security
expression can itself call request.security() up to two more levels.
Set to 0 to completely disable request.security().
max_security_calls: usizeMaximum number of unique (symbol, timeframe) streams for
request.security() calls.
Multiple call sites that request the same (symbol, timeframe) pair
share a single stream and count as one toward this limit.
Set to 0 to completely disable request.security().
Implementations§
Source§impl ExecutionLimits
impl ExecutionLimits
Sourcepub const fn with_max_loop_iterations_per_bar(self, value: u64) -> Self
pub const fn with_max_loop_iterations_per_bar(self, value: u64) -> Self
Sets the maximum number of loop iterations allowed per bar.
Sourcepub const fn with_max_security_depth(self, value: usize) -> Self
pub const fn with_max_security_depth(self, value: usize) -> Self
Sets the maximum request.security() nesting depth.
Sourcepub const fn with_max_security_calls(self, value: usize) -> Self
pub const fn with_max_security_calls(self, value: usize) -> Self
Sets the maximum number of unique (symbol, timeframe) streams.
Trait Implementations§
Source§impl Clone for ExecutionLimits
impl Clone for ExecutionLimits
Source§fn clone(&self) -> ExecutionLimits
fn clone(&self) -> ExecutionLimits
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExecutionLimits
impl Debug for ExecutionLimits
Source§impl Default for ExecutionLimits
impl Default for ExecutionLimits
Source§impl<'de> Deserialize<'de> for ExecutionLimits
impl<'de> Deserialize<'de> for ExecutionLimits
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ExecutionLimits
impl PartialEq for ExecutionLimits
Source§impl Serialize for ExecutionLimits
impl Serialize for ExecutionLimits
impl Copy for ExecutionLimits
impl Eq for ExecutionLimits
impl StructuralPartialEq for ExecutionLimits
Auto Trait Implementations§
impl Freeze for ExecutionLimits
impl RefUnwindSafe for ExecutionLimits
impl Send for ExecutionLimits
impl Sync for ExecutionLimits
impl Unpin for ExecutionLimits
impl UnwindSafe for ExecutionLimits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.