Skip to main content

foxtive/
lib.rs

1use std::collections::HashMap;
2use std::sync::OnceLock;
3
4pub mod enums;
5pub mod results;
6
7#[cfg(feature = "redis")]
8pub mod redis;
9
10#[cfg(feature = "cache")]
11pub mod cache;
12#[cfg(feature = "database")]
13pub mod database;
14mod env;
15pub mod ext;
16mod ext_impl;
17pub mod helpers;
18#[cfg(feature = "http")]
19pub mod http;
20pub mod macros;
21#[cfg(feature = "rabbitmq")]
22pub mod rabbitmq;
23pub mod setup;
24pub mod tokio;
25
26pub static FOXTIVE: OnceLock<FoxtiveState> = OnceLock::new();
27
28/// Structured validation errors: field name → list of messages.
29pub type ValidationErrors = HashMap<String, Vec<String>>;
30
31pub use crate::setup::state::{FoxtiveHelpers, FoxtiveState};
32pub use ::http::StatusCode;
33pub use anyhow::Error;
34pub use async_trait::async_trait;
35pub use env::Environment;
36#[cfg(feature = "templating")]
37pub use tera::Context as TemplateContext;
38
39pub mod prelude {
40    pub use crate::enums::AppMessage;
41    pub use crate::ext::app_state::AppStateExt;
42    #[cfg(feature = "rabbitmq")]
43    pub use crate::rabbitmq::RabbitMQ;
44    #[cfg(feature = "redis")]
45    pub use crate::redis::Redis;
46    pub use crate::results::{AppResult, app_result::IntoAppResult};
47}