Sfoglia il codice sorgente

Extract prelude and envelope_saga into file modules

The workspace hygiene rules forbid inline module bodies (mod NAME { ... }) in
non-test code so that every namespace is visible in the directory tree.  Two
modules still used the inline form: the crate prelude and the legend!  saga
wrapper. Move both into their own files (prelude.rs and
ledger/envelope_saga.rs) and switch the declarations to file modules. The
prelude doc comment moves to inner form, dropping now-redundant explicit
intra-doc link targets that resolve on their own once the re-exports are in
scope.
Cesar Rodas 3 giorni fa
parent
commit
ad12b43d5b

+ 1 - 9
crates/kuatia/src/ledger.rs

@@ -29,15 +29,7 @@ use kuatia_storage::events::{LedgerEvent, LedgerEventKind};
 use kuatia_storage::store::{EnvelopeRecord, Store};
 
 #[allow(missing_docs)]
-mod envelope_saga {
-    use super::*;
-    legend! {
-        EnvelopeSaga<LedgerCtx, SagaError> {
-            reserve: ReservePostingsStep,
-            finalize: FinalizeTransferStep,
-        }
-    }
-}
+mod envelope_saga;
 use envelope_saga::*;
 
 /// Phase of an in-flight commit, persisted with the write-ahead record so

+ 8 - 0
crates/kuatia/src/ledger/envelope_saga.rs

@@ -0,0 +1,8 @@
+use super::*;
+
+legend! {
+    EnvelopeSaga<LedgerCtx, SagaError> {
+        reserve: ReservePostingsStep,
+        finalize: FinalizeTransferStep,
+    }
+}

+ 1 - 18
crates/kuatia/src/lib.rs

@@ -12,21 +12,4 @@ pub mod saga;
 // Re-export storage crate for convenience.
 pub use kuatia_storage::{error as store_error, mem_store, store, store_tests};
 
-/// Common imports for building on the ledger.
-///
-/// `use kuatia::prelude::*;` brings the domain types and intent builders from
-/// [`kuatia_core`] into scope, along with the [`Ledger`](crate::ledger::Ledger)
-/// resource, the [`Store`](kuatia_storage::store::Store) trait, and the
-/// [`InMemoryStore`](kuatia_storage::mem_store::InMemoryStore). Reach for the
-/// individual crates when you need types the prelude does not surface.
-pub mod prelude {
-    pub use kuatia_core::*;
-
-    pub use crate::error::LedgerError;
-    pub use crate::inflight::{
-        Authorization, InflightLeg, InflightLegStatus, InflightState, InflightStatus,
-    };
-    pub use crate::ledger::Ledger;
-    pub use kuatia_storage::mem_store::InMemoryStore;
-    pub use kuatia_storage::store::Store;
-}
+pub mod prelude;

+ 16 - 0
crates/kuatia/src/prelude.rs

@@ -0,0 +1,16 @@
+//! Common imports for building on the ledger.
+//!
+//! `use kuatia::prelude::*;` brings the domain types and intent builders from
+//! [`kuatia_core`] into scope, along with the [`Ledger`] resource, the
+//! [`Store`] trait, and the [`InMemoryStore`]. Reach for the individual crates
+//! when you need types the prelude does not surface.
+
+pub use kuatia_core::*;
+
+pub use crate::error::LedgerError;
+pub use crate::inflight::{
+    Authorization, InflightLeg, InflightLegStatus, InflightState, InflightStatus,
+};
+pub use crate::ledger::Ledger;
+pub use kuatia_storage::mem_store::InMemoryStore;
+pub use kuatia_storage::store::Store;