use apalis_core::error::BoxDynError;
#[cfg(feature = "actix")]
pub mod actix;
#[cfg(feature = "axum")]
pub mod axum;
#[cfg(feature = "salvo")]
pub mod salvo;
pub trait RegisterRoute<B, T> {
#[must_use]
fn register(self, queue: &str, backend: B) -> Self;
}
#[derive(Clone, Debug)]
pub struct ApiBuilder<R> {
router: R,
#[allow(unused)]
root: bool,
}
impl<R> ApiBuilder<R> {
pub fn new(router: R) -> Self {
Self { router, root: true }
}
pub fn new_with_router(router: R, register_root: bool) -> Self {
Self {
router,
root: register_root,
}
}
pub fn build(self) -> R {
self.router
}
}
#[derive(Debug, thiserror::Error)]
pub enum TaskRejection {
#[error("Invalid context header: {name} - {reason}")]
BadHeader {
name: String,
reason: String,
},
#[error("Failed to deserialize body: {0}")]
Body(BoxDynError),
}