crates/mimir-driver/tests/fixture-tables/seam/src/lib.rs
//! A backend SEAM: a trait whose impls live downstream of its callers (as
//! `nornir-warehouse-trait` is to the crates that hold `&dyn Warehouse`).
//! This crate does not even depend on the storage engine. There is no body
//! to derive anything from, so the trait says it itself — the ONE
//! annotation, `#[cfg_attr(mimir, mimir::table(<access>, <parameter>))]`.
pub trait Sink {
#[cfg_attr(mimir, mimir::table(write, table))]
fn push(&self, table: &str, rows: &[String]);
#[cfg_attr(mimir, mimir::table(read, table))]
fn pull(&self, table: &str) -> Vec<String>;
/// Not annotated: `text` is no table.
fn note(&self, text: &str);
}
/// A caller INSIDE the seam crate — compiled before any impl exists.
pub fn record(sink: &dyn Sink, rows: &[String]) {
sink.push("seam_table", rows);
}
/// A conduit over the annotated method: its callers name the table.
pub fn forward(sink: &dyn Sink, table: &str) -> usize {
sink.pull(table).len()
}
/// An annotation the driver does not understand (no such access word): it is
/// counted, and gives NO summary.
#[cfg_attr(mimir, mimir::table(sideways, table))]
pub fn misannotated(table: &str) -> usize {
table.len()
}