From 56291a91f82f91f19f145f19ff8f96ffc3121ab0 Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 13 Jan 2024 16:58:33 -0500 Subject: [PATCH] Expose all subcrates --- Cargo.toml | 18 +++++++++++++++++- src/lib.rs | 27 +++++++++++++++++++++------ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 84265be..109ad30 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,16 @@ members = [ "examples/metrics-example", "examples/panic-example", "examples/postgres-example", + "examples/tokio-example", ] [features] -default = ["background-jobs-actix", "background-jobs-metrics"] +default = ["actix-rt", "metrics"] +actix-rt = ["dep:background-jobs-actix"] +metrics = ["dep:background-jobs-metrics"] +postgres = ["dep:background-jobs-postgres"] +sled = ["dep:background-jobs-sled"] +tokio = ["dep:background-jobs-tokio"] completion-logging = [ "background-jobs-core/completion-logging", "error-logging", @@ -51,3 +57,13 @@ optional = true version = "0.17.0" path = "jobs-postgres" optional = true + +[dependencies.background-jobs-sled] +version = "0.17.0" +path = "jobs-sled" +optional = true + +[dependencies.background-jobs-tokio] +version = "0.17.0" +path = "jobs-tokio" +optional = true diff --git a/src/lib.rs b/src/lib.rs index 7f1624a..89c1a26 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -112,7 +112,7 @@ //! ``` //! //! #### Running jobs -//! By default, this crate ships with the `background-jobs-actix` feature enabled. This uses the +//! By default, this crate ships with the `actix-rt` feature enabled. This uses the //! `background-jobs-actix` crate to spin up a Server and Workers, and provides a mechanism for //! spawning new jobs. //! @@ -163,7 +163,7 @@ pub use background_jobs_core::{Backoff, Job, MaxRetries, UnsendJob, UnsendSpawner}; -#[cfg(feature = "background-jobs-metrics")] +#[cfg(feature = "metrics")] pub mod metrics { pub use background_jobs_metrics::{ build, install, JobStat, MetricsStorage, SetRecorderError, Stats, StatsHandle, @@ -182,14 +182,29 @@ pub mod dev { pub mod memory_storage { pub use background_jobs_core::memory_storage::{Storage, Timer}; - #[cfg(feature = "background-jobs-actix")] + #[cfg(feature = "actix-rt")] pub use background_jobs_actix::ActixTimer; + + #[cfg(feature = "tokio")] + pub use background_jobs_tokio::TokioTimer; } -#[cfg(feature = "background-jobs-actix")] -pub use background_jobs_actix::{ActixSpawner, Manager, QueueHandle, WorkerConfig}; +#[cfg(feature = "actix-rt")] +pub mod actix { + pub use background_jobs_actix::{ActixSpawner as Spawner, Manager, QueueHandle, WorkerConfig}; +} -#[cfg(feature = "background-jobs-postgres")] +#[cfg(feature = "postgres")] pub mod postgres { pub use background_jobs_postgres::Storage; } + +#[cfg(feature = "sled")] +pub mod sled { + pub use background_jobs_sled::{Error, Storage}; +} +#[cfg(feature = "tokio")] + +pub mod tokio { + pub use background_jobs_tokio::{QueueHandle, WorkerConfig}; +}