icydb_core/macros.rs
1// start
2// macro to be included at the start of each canister lib.rs file
3/// Include the generated actor module emitted by `build!` (placed in `OUT_DIR/actor.rs`).
4#[macro_export]
5macro_rules! start {
6 () => {
7 // actor.rs
8 include!(concat!(env!("OUT_DIR"), "/actor.rs"));
9 };
10}
11
12// db
13/// Access the current canister's database session; use `db!()` or `db!(debug)` for verbose tracing.
14#[macro_export]
15#[allow(clippy::crate_in_macro_def)]
16macro_rules! db {
17 () => {
18 crate::db()
19 };
20
21 (debug) => {
22 crate::db().debug()
23 };
24}