Expand description
Derive macros for ArkheKernel.
Three derives, one shared shape:
#[derive(ArkheAction)]— emitsSealed+ActionDeriv. The user suppliesimpl ActionCompute for T { fn compute ... }; the kernel-side blanketimpl<T: ActionDeriv + ActionCompute> Action for Tprovides the postcard-canonicalcanonical_bytes/from_bytes/approx_sizedefaults.#[derive(ArkheComponent)]— emitsSealed+Component. No user method to implement; the trait’s default methods (postcard) handle the data round trip.#[derive(ArkheEvent)]— emitsSealed+Event, same shape as Component. The user type must additionally deriveDebugplusserde::{Serialize, Deserialize}.
Every derive expects #[arkhe(type_code = N, schema_version = M)].
schema_version defaults to 1 when omitted; type_code is mandatory.
ⓘ
use arkhe_kernel::{ArkheComponent, ArkheEvent};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, ArkheComponent)]
#[arkhe(type_code = 5001, schema_version = 1)]
struct CounterComponent { value: u64 }
#[derive(Debug, Serialize, Deserialize, ArkheEvent)]
#[arkhe(type_code = 8001)]
struct PostCreatedEvent { author: u64, body: String }Derive Macros§
- Arkhe
Action - Derive
Sealed+ActionDerivfor a domain action. Pair withimpl ActionCompute for ...to satisfy the kernelActionblanket. - Arkhe
Component - Derive
Sealed+Component. Default trait methods (postcard) covercanonical_bytes/from_bytes/approx_size— no user method required beyondserde::{Serialize, Deserialize}derives. - Arkhe
Event - Derive
Sealed+Event. Same shape asArkheComponent; the user type must additionally deriveDebugplus serde.