Skip to main content

EvalContext

Trait EvalContext 

Source
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§

Source

fn path_format(&self) -> PathFormat

Source

fn count_op(&mut self) -> Result<(), ExpressionError>

Source

fn count_ops(&mut self, n: usize) -> Result<(), ExpressionError>

Source

fn count_string_ops(&mut self, len: usize) -> Result<(), ExpressionError>

Source

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§

Source

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".

Implementors§