pub mod schema {
pub use vespera_core::schema::*;
}
pub mod route {
pub use vespera_core::route::*;
}
pub mod openapi {
pub use vespera_core::openapi::*;
}
pub use vespera_core::openapi::OpenApi;
pub use vespera_macro::{Multipart, Schema, cron, export_app, route, schema, schema_type, vespera};
pub use serde_json;
pub use chrono;
pub mod multipart;
pub use tempfile;
#[cfg(feature = "cron")]
pub use tokio_cron_scheduler;
#[cfg(feature = "cron")]
pub use tokio;
pub mod axum {
pub use axum::*;
}
pub mod axum_extra {
pub use axum_extra::*;
}
pub struct VesperaRouter<S>
where
S: Clone + Send + Sync + 'static,
{
base: axum::Router<S>,
merge_fns: Vec<fn() -> axum::Router<()>>,
}
impl<S> VesperaRouter<S>
where
S: Clone + Send + Sync + 'static,
{
#[must_use]
pub fn new(base: axum::Router<S>, merge_fns: Vec<fn() -> axum::Router<()>>) -> Self {
Self { base, merge_fns }
}
pub fn with_state(self, state: S) -> axum::Router<()> {
let mut router: axum::Router<()> = self.base.with_state(state);
for merge_fn in self.merge_fns {
router = router.merge(merge_fn());
}
router
}
#[must_use]
pub fn layer<L>(self, layer: L) -> Self
where
L: tower_layer::Layer<axum::routing::Route> + Clone + Send + Sync + 'static,
L::Service: tower_service::Service<axum::extract::Request> + Clone + Send + Sync + 'static,
<L::Service as tower_service::Service<axum::extract::Request>>::Response:
axum::response::IntoResponse + 'static,
<L::Service as tower_service::Service<axum::extract::Request>>::Error:
Into<std::convert::Infallible> + 'static,
<L::Service as tower_service::Service<axum::extract::Request>>::Future: Send + 'static,
{
Self {
base: self.base.layer(layer),
merge_fns: self.merge_fns,
}
}
}
pub use tower_layer;
pub use tower_service;
#[cfg(feature = "inprocess")]
pub use vespera_inprocess as inprocess;
#[cfg(feature = "jni")]
pub use vespera_jni as jni;
#[cfg(feature = "jni")]
#[macro_export]
macro_rules! jni_app {
($factory:expr) => {
$crate::jni::jni_app!($factory);
};
}