Skip to main content

harmos_macros/
lib.rs

1/* ***
2 *
3 * Harmos
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * ***
8 */
9
10/* === Modules === */
11
12mod artifact;
13mod catalog;
14mod identity;
15mod message;
16mod operation;
17mod path;
18mod presentation;
19
20/* === Re-Exports === */
21
22/* === Imports === */
23
24// Standard Library Imports
25
26// Third Party Imports
27use proc_macro::TokenStream;
28// Local Imports
29use identity::Sort;
30
31/* === Constants === */
32
33/* === Macros === */
34
35/* === Type Aliases === */
36
37/* === Structs === */
38
39/* === Enums === */
40
41/* === Traits === */
42
43/* === Implementations === */
44
45/* === Public Functions === */
46
47#[proc_macro_attribute]
48pub fn catalog(attribute: TokenStream, item: TokenStream) -> TokenStream {
49    catalog::typed::declare(attribute.into(), item.into()).into()
50}
51
52#[proc_macro_attribute]
53pub fn operation(attribute: TokenStream, item: TokenStream) -> TokenStream {
54    operation::declare(attribute.into(), item.into()).into()
55}
56
57#[proc_macro_attribute]
58pub fn lanes(attribute: TokenStream, item: TokenStream) -> TokenStream {
59    catalog::lanes::close(attribute.into(), item.into()).into()
60}
61
62#[proc_macro_attribute]
63pub fn transaction(attribute: TokenStream, item: TokenStream) -> TokenStream {
64    identity::stamp(attribute.into(), item.into(), Sort::Transaction).into()
65}
66
67#[proc_macro_attribute]
68pub fn record(attribute: TokenStream, item: TokenStream) -> TokenStream {
69    identity::stamp(attribute.into(), item.into(), Sort::Record).into()
70}
71
72#[proc_macro_attribute]
73pub fn stream(attribute: TokenStream, item: TokenStream) -> TokenStream {
74    identity::stream::stamp(attribute.into(), item.into()).into()
75}
76
77#[proc_macro_attribute]
78pub fn transactions(attribute: TokenStream, item: TokenStream) -> TokenStream {
79    catalog::close(attribute.into(), item.into(), Sort::Transaction).into()
80}
81
82#[proc_macro_attribute]
83pub fn records(attribute: TokenStream, item: TokenStream) -> TokenStream {
84    catalog::close(attribute.into(), item.into(), Sort::Record).into()
85}
86
87#[proc_macro_attribute]
88pub fn streams(attribute: TokenStream, item: TokenStream) -> TokenStream {
89    catalog::streams::close(attribute.into(), item.into()).into()
90}
91
92#[proc_macro_attribute]
93pub fn plugin(attribute: TokenStream, item: TokenStream) -> TokenStream {
94    artifact::plugin::declare(attribute.into(), item.into()).into()
95}
96
97#[proc_macro_attribute]
98pub fn observer(attribute: TokenStream, item: TokenStream) -> TokenStream {
99    artifact::observer::declare(attribute.into(), item.into()).into()
100}
101
102#[proc_macro_attribute]
103pub fn listener(attribute: TokenStream, item: TokenStream) -> TokenStream {
104    artifact::listener::declare(attribute.into(), item.into()).into()
105}
106
107#[proc_macro_attribute]
108pub fn message(attribute: TokenStream, item: TokenStream) -> TokenStream {
109    message::declare(attribute.into(), item.into()).into()
110}
111
112/* === Private Functions === */
113
114/* === Tests === */