Expand description
Canic facade crate.
This crate is the recommended dependency for downstream canister projects. It re-exports the public Canic runtime surface and provides the common macro entry points:
build!/build_root!forbuild.rs(validate/embedcanic.toml)start!/start_root!forlib.rs(wire lifecycle hooks and export endpoints)
For lower-level access, use the api, cdk, memory, and utils modules.
Direct access to internal core modules is intentionally unsupported.
Re-exports§
pub use canic_cdk as cdk;pub use canic_dsl as dsl;pub use canic_memory as memory;pub use canic_utils as utils;
Modules§
- api
- Structured public runtime API surface.
- dto
- DTO boundary definitions.
- ids
- Layer-neutral identifiers and boundary-safe primitives.
- prelude
- Opinionated prelude for Canic canister crates.
- protocol
Macros§
- auth_
require_ all - Enforce that every supplied rule future succeeds for the current caller.
- auth_
require_ any - Enforce that at least one supplied rule future succeeds for the current caller.
- build
- Embed the shared Canic configuration into a canister crate’s build script.
- build_
root - Embed the shared configuration for the root orchestrator canister.
- canic_
endpoints - canic_
endpoints_ nonroot - canic_
endpoints_ root - eager_
init - Run
$bodyduring process start-up usingctor. - 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.
- impl_
storable_ bounded - Implement
Storablewith a bounded size guarantee. - impl_
storable_ unbounded - Implement
Storablewithout a size bound. - log
- Log a runtime entry using Canic’s structured logger.
- perf
- Log elapsed instruction counts since the last
perf!invocation in this thread. - start
- Configure lifecycle hooks for non-root Canic canisters.
- start_
root - Configure lifecycle hooks for the root orchestrator canister.
- timer
- timer Schedule a one-shot timer with an auto-generated label.
- timer_
guarded - timer_guarded Schedule a one-shot timer if none is already scheduled for the slot. Returns true when a new timer was scheduled.
- timer_
interval - timer_interval Schedule a repeating timer with an auto-generated label.
- timer_
interval_ guarded - timer_interval_guarded Schedule an init timer that installs a repeating timer for the slot. Returns true when a new timer was scheduled.
Structs§
- Error
- Error
Constants§
Attribute Macros§
- canic_
query - Define a Canic query endpoint.
- canic_
update - Define a Canic update endpoint.