RLogic

Struct RLogic 

Source
pub struct RLogic { /* private fields */ }
Expand description

Main RLogic engine combining compilation and evaluation

Implementations§

Source§

impl RLogic

Source

pub fn new() -> Self

Create a new RLogic instance with default configuration

Source

pub fn with_config(config: RLogicConfig) -> Self

Create a new RLogic instance with custom configuration

Source

pub fn compile(&mut self, logic: &Value) -> Result<LogicId, String>

Compile a JSON Logic expression

Source

pub fn run(&self, logic_id: &LogicId, data: &Value) -> Result<Value, String>

Evaluate a compiled logic expression against data

Source

pub fn run_with_context( &self, logic_id: &LogicId, user_data: &Value, internal_context: &Value, ) -> Result<Value, String>

Evaluate a compiled logic expression with internal context

§Arguments
  • logic_id - The compiled logic ID
  • user_data - User’s data (primary lookup source)
  • internal_context - Internal variables (e.g., $iteration, $threshold, column vars)

Variables are resolved in order: internal_context → user_data

Source

pub fn run_with_config( &self, logic_id: &LogicId, data: &Value, config: &RLogicConfig, ) -> Result<Value, String>

Evaluate a compiled logic expression with custom config

Source

pub fn evaluate(&self, logic: &Value, data: &Value) -> Result<Value, String>

Compile and evaluate a logic expression directly

Source

pub fn get_referenced_vars(&self, logic_id: &LogicId) -> Option<Vec<String>>

Get the referenced variables in a compiled logic

Source

pub fn has_forward_reference(&self, logic_id: &LogicId) -> bool

Check if a compiled logic has forward references (e.g., references future iterations)

Trait Implementations§

Source§

impl Default for RLogic

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for RLogic

§

impl RefUnwindSafe for RLogic

§

impl Send for RLogic

§

impl Sync for RLogic

§

impl Unpin for RLogic

§

impl UnwindSafe for RLogic

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.