lazy_query

Macro lazy_query 

Source
macro_rules! lazy_query {
    ($data:expr, $type:ty => $($tail:tt)*) => { ... };
    ($data:expr) => { ... };
}
Expand description

Creates a lazy query with multiple filters in a concise syntax.

§Syntax

lazy_query!(data, Type =>
    field1 == value1,
    field2 > value2,
    field3.contains("text")
)

§Example

// Instead of:
let results = LazyQuery::new(&products)
    .where_(Product::category_r(), |cat| cat == "Electronics")
    .where_(Product::price_r(), |&p| p < 500.0)
    .where_(Product::stock_r(), |&s| s > 0)
    .collect();

// Write:
let results = lazy_query!(products, Product =>
    category == "Electronics",
    price < 500.0,
    stock > 0
).collect();