canic_core/ids/intent.rs
1//! Module: ids::intent
2//!
3//! Responsibility: intent identifiers and resource keys.
4//! Does not own: intent execution, replay policy, or resource authorization.
5//! Boundary: exposes compact IDs used across workflow and ops boundaries.
6
7use crate::cdk::types::BoundedString128;
8use serde::{Deserialize, Serialize};
9use std::fmt::{self, Display};
10
11///
12/// IntentId
13///
14/// Numeric identifier for one recorded or replayable intent.
15/// Owned by ids and consumed by intent storage and replay/cost guards.
16///
17
18#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
19pub struct IntentId(pub u64);
20
21impl Display for IntentId {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 write!(f, "{}", self.0)
24 }
25}
26
27///
28/// IntentResourceKey
29///
30/// Bounded resource key associated with an intent.
31/// Owned by ids and consumed by intent storage and cost guard accounting.
32///
33
34pub type IntentResourceKey = BoundedString128;