Struct ConditionEvaluator

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

Enhanced condition evaluator for processor dispatch

This evaluator extends the basic condition system with processor-specific evaluation capabilities, including data pattern matching, context evaluation, and complex condition expressions.

§ExifTool Reference

ExifTool uses various condition patterns in SubDirectory definitions:

{
    Condition => '$$valPt =~ /^0204/',
    SubDirectory => { ProcessProc => \&ProcessNikonEncrypted }
},
{
    Condition => '$$self{Model} =~ /EOS R5/',
    SubDirectory => { ProcessProc => \&ProcessCanonSerialDataMkII }
}

Implementations§

Source§

impl ConditionEvaluator

Source

pub fn new() -> Self

Create a new condition evaluator

Source

pub fn evaluate_context_condition( &mut self, context: &ProcessorContext, condition_expr: &str, ) -> Result<bool>

Evaluate a condition expression against a processor context

This method parses and evaluates ExifTool-style condition expressions against the provided context, returning true if the condition matches.

§Examples
  • "$model =~ /EOS R5/" - Model contains “EOS R5”
  • "$manufacturer eq 'Canon'" - Exact manufacturer match
  • "exists($serialNumber)" - Serial number tag is available
  • "$tagID == 0x001d" - Specific tag ID match
Source

pub fn evaluate_data_condition( &mut self, data: &[u8], condition_expr: &str, ) -> Result<bool>

Evaluate a condition against data pattern

This method evaluates conditions that match against binary data patterns, commonly used for format detection and processor selection.

Source

pub fn evaluate_data_condition_parsed( &mut self, data: &[u8], condition: &Condition, ) -> Result<bool>

Evaluate a parsed condition against binary data

Source

pub fn register_tag_evaluator<E: TagEvaluator + 'static>( &mut self, name: String, evaluator: E, )

Register a custom tag evaluator

Trait Implementations§

Source§

impl Default for ConditionEvaluator

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more