Skip to main content

for_each_query_vtable

Macro for_each_query_vtable 

Source
macro_rules! for_each_query_vtable {
    (ALL, $tcx:expr, $closure:expr) => { ... };
    (CACHE_ON_DISK, $tcx:expr, $closure:expr) => { ... };
}
Expand description

Given a filter condition (e.g. ALL or CACHE_ON_DISK), a tcx, and a closure expression that accepts &QueryVTable, this macro calls that closure with each query vtable that satisfies the filter condition.

This needs to be a macro, because the vtables can have different key/value/cache types for different queries.

This macro’s argument syntax is specifically intended to look like plain Rust code, so that for_each_query_vtable!(..) calls will be formatted by rustfmt.

To avoid too much nested-macro complication, filter conditions are implemented by hand as needed.