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 policies centralized:

  • access/ contains guard/auth/rule helpers for boundary enforcement.
  • workflow/ implements orchestration and lifecycle workflows.
  • policy/ owns deterministic decision rules.
  • ops/ provides mechanical, reusable side-effecting operations.
  • model/ owns storage (stable memory) and in-process registries/caches.
  • macro entrypoints live in the canic facade crate.

The default flow is: endpoints → workflow → policy → ops → model.

Re-exports§

pub use ::canic_cdk as cdk;
pub use ::canic_memory as memory;
pub use ::canic_utils as utils;

Modules§

access
api
Public API façade for canister endpoints.
domain
dto
DTO boundary definitions.
error
ids
Layer-neutral identifiers and boundary-safe primitives.
log
perf
Cross-cutting performance instrumentation.
protocol

Macros§

eager_init
Run $body during process start-up using ctor.
eager_static
Declare a thread-local static and schedule an eager initialization touch.
ic_memory
Declare a stable-memory slot backed by the Canic memory registry.
ic_memory_range
Reserve a contiguous block of stable-memory IDs for the current crate.
log

Constants§

CRATE_NAME
Crate Version
VERSION

Functions§

init_config