diff --git a/crates/mad/examples/basic/main.rs b/crates/mad/examples/basic/main.rs index 8f7bce0..f75e5ba 100644 --- a/crates/mad/examples/basic/main.rs +++ b/crates/mad/examples/basic/main.rs @@ -5,12 +5,12 @@ use tracing::Level; struct WaitServer {} #[async_trait] -impl mad::Component for WaitServer { +impl notmad::Component for WaitServer { fn name(&self) -> Option { Some("WaitServer".into()) } - async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> { + async fn run(&self, cancellation: CancellationToken) -> Result<(), notmad::MadError> { let millis_wait = rand::thread_rng().gen_range(500..3000); tracing::debug!("waiting: {}ms", millis_wait); @@ -28,7 +28,7 @@ async fn main() -> anyhow::Result<()> { .with_max_level(Level::TRACE) .init(); - mad::Mad::builder() + notmad::Mad::builder() .add(WaitServer {}) .add(WaitServer {}) .add(WaitServer {}) diff --git a/crates/mad/examples/error_log/main.rs b/crates/mad/examples/error_log/main.rs index 47da2d5..f60496d 100644 --- a/crates/mad/examples/error_log/main.rs +++ b/crates/mad/examples/error_log/main.rs @@ -5,12 +5,12 @@ use tracing::Level; struct ErrorServer {} #[async_trait] -impl mad::Component for ErrorServer { +impl notmad::Component for ErrorServer { fn name(&self) -> Option { Some("ErrorServer".into()) } - async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> { + async fn run(&self, cancellation: CancellationToken) -> Result<(), notmad::MadError> { let millis_wait = rand::thread_rng().gen_range(500..3000); tracing::debug!("waiting: {}ms", millis_wait); @@ -18,7 +18,7 @@ impl mad::Component for ErrorServer { // Simulates a server running for some time. Is normally supposed to be futures blocking indefinitely tokio::time::sleep(std::time::Duration::from_millis(millis_wait)).await; - Err(mad::MadError::Inner(anyhow::anyhow!("expected error"))) + Err(notmad::MadError::Inner(anyhow::anyhow!("expected error"))) } } @@ -30,7 +30,7 @@ async fn main() -> anyhow::Result<()> { // Do note that only the first server which returns an error is guaranteed to be handled. This is because if servers don't respect cancellation, they will be dropped - mad::Mad::builder() + notmad::Mad::builder() .add(ErrorServer {}) .add(ErrorServer {}) .add(ErrorServer {}) diff --git a/crates/mad/examples/fn/main.rs b/crates/mad/examples/fn/main.rs index b746597..a59c176 100644 --- a/crates/mad/examples/fn/main.rs +++ b/crates/mad/examples/fn/main.rs @@ -5,12 +5,12 @@ use tracing::Level; struct WaitServer {} #[async_trait] -impl mad::Component for WaitServer { +impl notmad::Component for WaitServer { fn name(&self) -> Option { Some("WaitServer".into()) } - async fn run(&self, _cancellation: CancellationToken) -> Result<(), mad::MadError> { + async fn run(&self, _cancellation: CancellationToken) -> Result<(), notmad::MadError> { let millis_wait = rand::thread_rng().gen_range(500..3000); tracing::debug!("waiting: {}ms", millis_wait); @@ -30,7 +30,7 @@ async fn main() -> anyhow::Result<()> { let item = "some item".to_string(); - mad::Mad::builder() + notmad::Mad::builder() .add(WaitServer {}) .add_fn(|_cancel| async move { let millis_wait = 50; diff --git a/crates/mad/examples/signals/main.rs b/crates/mad/examples/signals/main.rs index 21594c6..ed9c086 100644 --- a/crates/mad/examples/signals/main.rs +++ b/crates/mad/examples/signals/main.rs @@ -5,12 +5,12 @@ use tracing::Level; struct WaitServer {} #[async_trait] -impl mad::Component for WaitServer { +impl notmad::Component for WaitServer { fn name(&self) -> Option { Some("WaitServer".into()) } - async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> { + async fn run(&self, cancellation: CancellationToken) -> Result<(), notmad::MadError> { let millis_wait = rand::thread_rng().gen_range(500..3000); tracing::debug!("waiting: {}ms", millis_wait); @@ -24,12 +24,12 @@ impl mad::Component for WaitServer { struct RespectCancel {} #[async_trait] -impl mad::Component for RespectCancel { +impl notmad::Component for RespectCancel { fn name(&self) -> Option { Some("RespectCancel".into()) } - async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> { + async fn run(&self, cancellation: CancellationToken) -> Result<(), notmad::MadError> { cancellation.cancelled().await; tracing::debug!("stopping because job is cancelled"); @@ -39,12 +39,12 @@ impl mad::Component for RespectCancel { struct NeverStopServer {} #[async_trait] -impl mad::Component for NeverStopServer { +impl notmad::Component for NeverStopServer { fn name(&self) -> Option { Some("NeverStopServer".into()) } - async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> { + async fn run(&self, cancellation: CancellationToken) -> Result<(), notmad::MadError> { // Simulates a server running for some time. Is normally supposed to be futures blocking indefinitely tokio::time::sleep(std::time::Duration::from_millis(999999999)).await; @@ -58,7 +58,7 @@ async fn main() -> anyhow::Result<()> { .with_max_level(Level::TRACE) .init(); - mad::Mad::builder() + notmad::Mad::builder() .add(WaitServer {}) .add(NeverStopServer {}) .add(RespectCancel {}) diff --git a/crates/mad/tests/mod.rs b/crates/mad/tests/mod.rs index 388c86a..aa54fbf 100644 --- a/crates/mad/tests/mod.rs +++ b/crates/mad/tests/mod.rs @@ -1,5 +1,5 @@ use async_trait::async_trait; -use mad::{Component, Mad}; +use notmad::{Component, Mad}; use rand::Rng; use tokio_util::sync::CancellationToken; use tracing_test::traced_test; @@ -12,7 +12,7 @@ impl Component for NeverEndingRun { Some("NeverEndingRun".into()) } - async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> { + async fn run(&self, cancellation: CancellationToken) -> Result<(), notmad::MadError> { let millis_wait = rand::thread_rng().gen_range(50..1000); tokio::time::sleep(std::time::Duration::from_millis(millis_wait)).await;