Skip to main content

Module extensions

Module extensions 

Source
Expand description

Generic extension storage for AimDbBuilder and AimDb.

External crates store typed state here during builder configuration and retrieve it during record setup or at query time. This is the hook mechanism used by aimdb-persistence — and any other crate that needs to attach data to the builder or the live database without modifying aimdb-core.

§Example

// Storing a value (e.g. from an external "with_persistence" builder ext):
builder.extensions_mut().insert(MyState { flag: true });
// Retrieving it from a RecordRegistrar closure:
let state = reg.extensions().get::<MyState>().expect("MyState not configured");
// Retrieving it from a live AimDb handle (query time):
let state = db.extensions().get::<MyState>().expect("MyState not configured");

Structs§

Extensions
Generic extension storage for AimDbBuilder and AimDb.