Skip to main content

projection_store_conformance

Macro projection_store_conformance 

macro_rules! projection_store_conformance {
    (mod_name = $mod_name:ident, emit = $emit:path, fixture = $fixture:expr) => { ... };
    (mod_name = $mod_name:ident, fixture = $fixture:expr) => { ... };
    ($fixture:expr) => { ... };
}
Expand description

Generates the projection conformance suite for a ProjectionStore adapter.

Takes an expression that produces a ProjectionFixture — one isolated backing projection store per instance, each connect() one handle onto it. See the crate documentation for what is checked and what the adapter must provide.

The rule list is not written here; it comes from for_each_projection_store_rule!, which is the only place it is written at all. A caller writes one line and names no rule, so a failure names the rule that broke rather than reporting “conformance failed”.

§What your adapter needs first

ProjectionFixture::Store is bound on ProjectionProbe, so an adapter implements that beside its ProjectionStore impl. It lives in happenstance-core behind the off-by-default conformance feature — one flag on a dependency you already have, and no new edge in your dependency graph.

§Examples

use happenstance_testkit::fixtures::MemoryProjectionFixture;

happenstance_testkit::projection_store_conformance!(MemoryProjectionFixture::new());

Choosing a different harness — the emitter is a parameter here for the same reason it is on the event-store family, and the default module name differs from dcb_conformance so both suites can be invoked from one file:

happenstance_testkit::projection_store_conformance!(
    mod_name = projection_conformance_blocking,
    emit = happenstance_testkit::emit_projection_blocking,
    fixture = MyProjectionFixture::new()
);