Skip to main content

Crate canic_core

Crate canic_core 

Source
Expand description

Core Canic library used inside canisters.

Most users should depend on the canic facade crate, which re-exports this crate under canic::core and exposes the common entrypoint macros:

  • canic::build! / canic::build_root! (in build.rs) to validate/embed canic.toml
  • canic::start! / canic::start_root! (in lib.rs) to wire lifecycle hooks and export endpoints

§Layering

Canic is organized to keep endpoint code thin and coordination centralized:

  • access/ contains access expressions, predicates, and metrics for boundary enforcement.
  • workflow/ implements orchestration and lifecycle workflows.
  • domain/ contains pure value and decision helpers.
  • ops/ provides mechanical, reusable side-effecting operations.
  • storage/ owns stable-memory-backed schemas and helpers.
  • view/ exposes internal read-only projections over stored/runtime state.
  • macro entrypoints live in the canic facade crate.

The default flow is: endpoints → workflow → domain/decision helpers → ops → storage.

Modules§

api
Public API façade for canister endpoints.
cdk
dto
DTO boundary definitions.
ids
Layer-neutral identifiers and boundary-safe primitives.
log
memory
Canic-managed stable-memory runtime boundary.
perf
Cross-cutting performance instrumentation.
protocol

Macros§

eager_init
Register one eager-init body for execution during lifecycle bootstrap.
eager_static
Declare a thread-local static and schedule an eager initialization touch.
ic_memory_key
Declare a stable-memory slot with an explicit ABI-stable key.
ic_memory_range
Declare a MemoryManager ID range owned by the declaring crate.
impl_storable_bounded
Storable helpers
impl_storable_unbounded
log
perf

Constants§

CANIC_MEMORY_MAX
CANIC_MEMORY_MIN
CANIC_WASM_CHUNK_BYTES
CRATE_NAME
Consts
VERSION