flawless/
lib.rs

1//! Flawless is a durable execution engine for Rust.
2//!
3//! For more information check out the docs at https://flawless.dev/docs.
4
5#[doc(hidden)]
6pub mod init;
7#[doc(hidden)]
8pub mod input;
9#[doc(hidden)]
10pub mod logger;
11#[doc(hidden)]
12pub mod panic;
13#[doc(hidden)]
14pub mod response;
15
16pub mod idempotent;
17pub mod message;
18pub mod rand;
19mod replay;
20pub mod secrets;
21pub mod time;
22pub mod workflow;
23
24/// Creates a workflow from a function.
25///
26/// ## Example:
27///
28/// ```
29/// use flawless::workflow;
30///
31/// #[workflow("hello_workflow")]
32/// fn hello_workflow() {
33///   // Implementation ...
34/// }
35/// ```
36pub use flawless_macros::workflow;
37
38/// Sets `name` and `version` for the flawless module.
39///
40/// Each module must have only one name and version set. The name is used to uniquely identify a module.
41///
42/// ## Example:
43///
44/// ```
45/// flawless::module!{ name = "test", version = "0.1.1" }
46/// ```
47#[macro_export]
48macro_rules! module {
49    (name = $name:literal, version = $version:literal) => {
50        #[export_name = concat!("#flawless#module#", $name, "%_#_%", $version)]
51        fn flawless_module_defenition___() {}
52    };
53}
54
55/// Implements the [`Message`](message::Message) trait for structs or enums.
56///
57/// This will also implement the [`serde::Serialize`] and [`serde::Deserialize`] traits.
58///
59/// ## Example:
60///
61/// ```
62/// use flawless::message;
63///
64/// #[message("empty")]
65/// struct Empty;
66/// ```
67pub use flawless_macros::message;
68
69#[doc(hidden)]
70pub use flawless_wasabi as wasabi;
71#[doc(hidden)]
72pub use serde;
73#[doc(hidden)]
74pub use serde_json;