fix(ci): gate event crate doctest behind mem feature and apply rustfmt

The crate-root doctest used InMemoryEventBus/TypedEventBus (gated behind
the 'mem' feature), so `cargo test -p mytheclipse-event --no-default-features
--features amqp|nats` failed to compile the doctest (E0432). The example is
now no_run with the mem-dependent imports inside a #[cfg(feature="mem")]
main, so it compiles (and runs) when mem is on and degrades to an empty main
when off.

Also apply rustfmt to mytheclipse-config/dynamic.rs and
mytheclipse-storage/{gcs,s3}.rs to satisfy cargo fmt --all --check.
This commit is contained in:
asepharyana
2026-08-28 22:41:06 +07:00
parent b2d3f32d83
commit 19941156b4
4 changed files with 34 additions and 14 deletions
+16 -9
View File
@@ -15,20 +15,27 @@
//!
//! ## Example
//!
//! ```
//! use mytheclipse_event::{EventBus, InMemoryEventBus, TypedEventBus};
//! The in-memory + typed bus (`mem` feature, on by default):
//!
//! ```no_run
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Debug, Serialize, Deserialize, PartialEq)]
//! struct OrderCreated { id: u64 }
//!
//! # #[tokio::main] async fn main() {
//! let bus = TypedEventBus::new(InMemoryEventBus::default());
//! let mut sub = bus.subscribe::<OrderCreated>("orders").await.unwrap();
//! bus.publish("orders", &OrderCreated { id: 42 }).await.unwrap();
//! let event = sub.recv().await.unwrap();
//! assert_eq!(event, OrderCreated { id: 42 });
//! # }
//! #[cfg(feature = "mem")]
//! #[tokio::main]
//! async fn main() {
//! use mytheclipse_event::{EventBus, InMemoryEventBus, TypedEventBus};
//! let bus = TypedEventBus::new(InMemoryEventBus::default());
//! let mut sub = bus.subscribe::<OrderCreated>("orders").await.unwrap();
//! bus.publish("orders", &OrderCreated { id: 42 }).await.unwrap();
//! let event = sub.recv().await.unwrap();
//! assert_eq!(event, OrderCreated { id: 42 });
//! }
//!
//! #[cfg(not(feature = "mem"))]
//! fn main() {}
//! ```
pub mod traits;