harmos_sdk/operations/
catalog.rs1use super::{Contract, ContractError, Contracts, Declarations, Definition, Entry, WireDeclaration};
22use harmos_domain::Result;
23use harmos_domain::catalog::{Catalog, Member, Visitor};
24
25pub struct AuthoredDeclarations;
34
35pub struct AuthoredContracts;
36
37impl Visitor for AuthoredDeclarations {
44 type Entry = Entry;
45}
46
47impl<T: super::Operation> Member<T> for AuthoredDeclarations {
48 const ENTRY: Entry = Entry::of::<T::Declaration>();
49}
50
51impl AuthoredDeclarations {
52 pub fn of<C: Catalog<Self>>() -> Result<Vec<Definition>> {
53 Declarations::from_projection(&C::ENTRIES)
54 }
55}
56
57impl Visitor for AuthoredContracts {
58 type Entry = WireDeclaration;
59}
60
61impl<T: super::Operation> Member<T> for AuthoredContracts {
62 const ENTRY: WireDeclaration = WireDeclaration::of::<T::Declaration>();
63}
64
65impl AuthoredContracts {
66 pub fn of<C: Catalog<Self>>() -> std::result::Result<Vec<Contract>, ContractError> {
67 Contracts::from_projection(&C::ENTRIES)
68 }
69}
70
71