Module static_filter

Module static_filter 

Source
Expand description

Static filter construction for zero-allocation filters.

This module provides zero-cost filter construction through:

  • Static field name constants
  • Type-level filter builders
  • Compile-time filter macros

§Performance

Static filters avoid heap allocations entirely:

  • Field names are &'static str (no Cow overhead)
  • Values are constructed inline
  • Common patterns are pre-computed

§Examples

use prax_query::static_filter::{StaticFilter, eq, gt, and2};
use prax_query::static_filter::fields;

// Zero-allocation filter construction
let filter = eq(fields::ID, 42);
let filter = gt(fields::AGE, 18);

// Combine two filters (optimized path)
let filter = and2(
    eq(fields::ACTIVE, true),
    gt(fields::SCORE, 100),
);

Modules§

fields
Common field name constants for zero-allocation filters.

Structs§

StaticFilter
A static filter with compile-time known field name.

Enums§

CompactValue
A compact filter value optimized for common cases.

Functions§

and2
Combine exactly 2 filters with AND (optimized, avoids vec allocation overhead).
and3
Combine exactly 3 filters with AND.
and4
Combine exactly 4 filters with AND.
and5
Combine exactly 5 filters with AND.
contains
Create a LIKE %value% filter with static field name.
ends_with
Create a LIKE %value filter with static field name.
eq
Create an equality filter with static field name.
gt
Create a greater-than filter with static field name.
gte
Create a greater-than-or-equal filter with static field name.
in_list
Create an IN filter with static field name.
is_not_null
Create an IS NOT NULL filter with static field name.
is_null
Create an IS NULL filter with static field name.
lt
Create a less-than filter with static field name.
lte
Create a less-than-or-equal filter with static field name.
ne
Create a not-equals filter with static field name.
not
Negate a filter.
not_in_list
Create a NOT IN filter with static field name.
or2
Combine exactly 2 filters with OR (optimized, avoids vec allocation overhead).
or3
Combine exactly 3 filters with OR.
or4
Combine exactly 4 filters with OR.
or5
Combine exactly 5 filters with OR.
starts_with
Create a LIKE value% filter with static field name.