Expand description
Arena-based filter pool for efficient nested filter construction.
This module provides a FilterPool that uses bump allocation to efficiently
construct complex nested filter trees with minimal allocations.
§When to Use
Use FilterPool when:
- Building deeply nested filter trees (depth > 3)
- Constructing many filters in a tight loop
- Performance profiling shows filter allocation as a bottleneck
For simple filters, use the regular Filter constructors directly.
§Examples
§Basic Usage
use prax_query::pool::FilterPool;
use prax_query::{Filter, FilterValue};
let mut pool = FilterPool::new();
// Build a complex nested filter efficiently
let filter = pool.build(|b| {
b.and(vec![
b.eq("status", "active"),
b.or(vec![
b.gt("age", 18),
b.eq("verified", true),
]),
b.not(b.eq("deleted", true)),
])
});
// The filter is now a regular owned Filter
assert!(!filter.is_none());§Reusing the Pool
use prax_query::pool::FilterPool;
let mut pool = FilterPool::new();
// Build first filter
let filter1 = pool.build(|b| b.eq("id", 1));
// Reset and reuse the pool
pool.reset();
// Build second filter (reuses the same memory)
let filter2 = pool.build(|b| b.eq("id", 2));Structs§
- Filter
Builder - A builder for constructing filters within a pool.
- Filter
Pool - A memory pool for efficient filter construction.
Enums§
- Pooled
Filter - A filter that lives in the pool’s arena.
- Pooled
Value - A filter value that lives in the pool’s arena.
Traits§
- Into
Pooled Value - Trait for types that can be converted to a pooled value.