pub trait EvalContext {
// Required methods
fn path_format(&self) -> PathFormat;
fn count_op(&mut self) -> Result<(), ExpressionError>;
fn count_ops(&mut self, n: usize) -> Result<(), ExpressionError>;
fn count_string_ops(&mut self, len: usize) -> Result<(), ExpressionError>;
fn check_memory(&self, bytes: usize) -> Result<(), ExpressionError>;
// Provided method
fn get_or_compile_regex(
&mut self,
pattern: &str,
) -> Result<Regex, ExpressionError> { ... }
}Expand description
Trait for the evaluator context that function implementations can access.
Required Methods§
fn path_format(&self) -> PathFormat
fn count_op(&mut self) -> Result<(), ExpressionError>
fn count_ops(&mut self, n: usize) -> Result<(), ExpressionError>
fn count_string_ops(&mut self, len: usize) -> Result<(), ExpressionError>
Sourcefn check_memory(&self, bytes: usize) -> Result<(), ExpressionError>
fn check_memory(&self, bytes: usize) -> Result<(), ExpressionError>
Pre-check that an allocation of bytes would not exceed the memory limit.
Call before large allocations to avoid temporarily exceeding the limit.
Provided Methods§
fn get_or_compile_regex( &mut self, pattern: &str, ) -> Result<Regex, ExpressionError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".