1#[doc(hidden)]
22pub mod __control_plane_core;
23#[doc(hidden)]
24pub mod access;
25pub mod api;
26#[doc(hidden)]
27pub mod bootstrap;
28#[doc(hidden)]
29pub mod dispatch;
30pub mod dto;
31#[doc(hidden)]
32pub mod error;
33mod format;
34pub mod ids;
35pub mod log;
36pub mod perf;
37pub mod protocol;
38#[cfg(test)]
39pub mod test;
40
41pub(crate) mod config;
42pub(crate) mod domain;
43pub(crate) mod infra;
44pub(crate) mod lifecycle;
45pub(crate) mod ops;
46pub(crate) mod storage;
47pub(crate) mod view;
48pub(crate) mod workflow;
49
50pub use {
51 ::canic_cdk as cdk,
52 ::canic_memory as memory,
53 ::canic_memory::{eager_init, eager_static, ic_memory, ic_memory_range},
54};
55
56pub(crate) use error::{InternalError, InternalErrorClass, InternalErrorOrigin};
57
58#[doc(hidden)]
61pub mod __reexports {
62 pub use ::ctor;
63}
64
65pub const CRATE_NAME: &str = env!("CARGO_PKG_NAME");
70pub const VERSION: &str = env!("CARGO_PKG_VERSION");
71pub const CANIC_MEMORY_MIN: u8 = storage::stable::CANIC_MEMORY_MIN;
72pub const CANIC_MEMORY_MAX: u8 = storage::stable::CANIC_MEMORY_MAX;
73pub const CANIC_WASM_CHUNK_BYTES: usize = 1_048_576;
76
77#[macro_export]
78macro_rules! perf {
79 ($($label:tt)*) => {{
80 $crate::perf::PERF_LAST.with(|last| {
81 let now = $crate::perf::perf_counter();
82 let then = *last.borrow();
83 let delta = now.saturating_sub(then);
84
85 *last.borrow_mut() = now;
86
87 let label = format!($($label)*);
88 $crate::perf::record_checkpoint(module_path!(), &label, delta);
89 });
90 }};
91}
92
93#[cfg(test)]
94#[macro_export]
95macro_rules! assert_err_variant {
96 ($err:expr, $pat:pat $(if $guard:expr)? $(,)?) => {{
97 match $err {
98 $pat $(if $guard)? => {}
99 other => panic!("unexpected error variant: {other:?}"),
100 }
101 }};
102}