harmos_domain/state/
catalog.rs1use super::{DecodeError, Kind};
22use crate::DefinitionId;
23
24pub type TransactionDecoder<T> = fn(&DefinitionId, u32, &[u8]) -> Result<Option<T>, DecodeError>;
31pub type Inverse<S, T> = fn(&T, &S) -> Option<T>;
32
33pub struct TransactionDefinitions<S, T> {
36 pub definitions: Vec<(Kind, DefinitionId, u32)>,
37 pub decode: TransactionDecoder<T>,
38 pub inverses: Inverse<S, T>,
39}
40
41pub struct RecordDefinitions<R> {
42 pub definitions: Vec<(Kind, DefinitionId, u32)>,
43 pub marker: std::marker::PhantomData<fn() -> R>,
44}
45
46impl<S, T> Clone for TransactionDefinitions<S, T> {
53 fn clone(&self) -> Self {
54 Self { definitions: self.definitions.clone(), decode: self.decode, inverses: self.inverses }
55 }
56}
57
58impl<R> Clone for RecordDefinitions<R> {
59 fn clone(&self) -> Self {
60 Self { definitions: self.definitions.clone(), marker: std::marker::PhantomData }
61 }
62}
63
64