pub struct RLogic { /* private fields */ }Expand description
Main RLogic engine combining compilation and evaluation
Implementations§
Source§impl RLogic
impl RLogic
Sourcepub fn with_config(config: RLogicConfig) -> Self
pub fn with_config(config: RLogicConfig) -> Self
Create a new RLogic instance with custom configuration
Sourcepub fn compile(&mut self, logic: &Value) -> Result<LogicId, String>
pub fn compile(&mut self, logic: &Value) -> Result<LogicId, String>
Compile a JSON Logic expression
Sourcepub fn run(&self, logic_id: &LogicId, data: &Value) -> Result<Value, String>
pub fn run(&self, logic_id: &LogicId, data: &Value) -> Result<Value, String>
Evaluate a compiled logic expression against data
Sourcepub fn run_with_context(
&self,
logic_id: &LogicId,
user_data: &Value,
internal_context: &Value,
) -> Result<Value, String>
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 IDuser_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
Sourcepub fn run_with_config(
&self,
logic_id: &LogicId,
data: &Value,
config: &RLogicConfig,
) -> Result<Value, String>
pub fn run_with_config( &self, logic_id: &LogicId, data: &Value, config: &RLogicConfig, ) -> Result<Value, String>
Evaluate a compiled logic expression with custom config
Sourcepub fn evaluate(&self, logic: &Value, data: &Value) -> Result<Value, String>
pub fn evaluate(&self, logic: &Value, data: &Value) -> Result<Value, String>
Compile and evaluate a logic expression directly
Sourcepub fn get_referenced_vars(&self, logic_id: &LogicId) -> Option<Vec<String>>
pub fn get_referenced_vars(&self, logic_id: &LogicId) -> Option<Vec<String>>
Get the referenced variables in a compiled logic
Sourcepub fn has_forward_reference(&self, logic_id: &LogicId) -> bool
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§
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> 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
Mutably borrows from an owned value. Read more