canic_core/api/
mod.rs

1//! Public API façade for canister endpoints.
2//!
3//! This module contains thin wrappers exposed to proc-macro–generated
4//! endpoints. Functions here translate public API calls into internal
5//! workflow or ops calls and map internal errors into `PublicError`.
6//!
7//! No orchestration or business logic should live here.
8//! Any wrapper callable from an endpoint must return a `Result` so errors
9//! are consistently mapped at the boundary.
10
11pub mod access;
12pub mod app;
13pub mod cascade;
14pub mod config;
15pub mod cycles;
16pub mod env;
17pub mod error;
18pub mod ic;
19pub mod icrc;
20pub mod icts;
21pub mod instrumentation;
22pub mod lifecycle;
23pub mod log;
24pub mod memory;
25pub mod metrics;
26pub mod placement;
27pub mod pool;
28pub mod rpc;
29pub mod state;
30pub mod timer;
31pub mod topology;
32pub mod wasm;
33
34///
35/// EndpointCall
36///
37
38#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
39pub struct EndpointCall {
40    pub endpoint: EndpointId,
41    pub kind: EndpointCallKind,
42}
43
44///
45/// EndpointId
46///
47
48#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
49pub struct EndpointId {
50    pub name: &'static str,
51}
52
53impl EndpointId {
54    #[must_use]
55    pub const fn new(name: &'static str) -> Self {
56        Self { name }
57    }
58}
59
60///
61/// EndpointCallKind
62///
63
64#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
65pub enum EndpointCallKind {
66    Query,
67    QueryComposite,
68    Update,
69}