1#![recursion_limit = "256"]
6#![warn(missing_docs)]
9
10macro_rules! setting_enum {
13 (
14 $(#[$meta:meta])*
15 pub enum $name:ident ($variable:literal) {
16 $( $(#[$vmeta:meta])* $variant:ident = $text:literal ),+ $(,)?
17 }
18 ) => {
19 $(#[$meta])*
20 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
21 #[non_exhaustive]
22 pub enum $name {
23 $( $(#[$vmeta])* $variant ),+
24 }
25
26 impl $name {
27 pub fn as_str(&self) -> &'static str {
29 match self {
30 $( Self::$variant => $text ),+
31 }
32 }
33
34 #[doc = $variable]
36 #[allow(dead_code)]
38 pub(crate) fn parse(value: &str) -> anyhow::Result<Self> {
39 Self::parse_as(value, $variable)
40 }
41
42 #[allow(dead_code)]
44 pub(crate) fn parse_as(value: &str, variable: &str) -> anyhow::Result<Self> {
45 let value = value.trim().to_ascii_lowercase();
46 $( if value == $text { return Ok(Self::$variant); } )+
47 let expected: &[&str] = &[$($text),+];
48 anyhow::bail!("{variable} must be one of {}, got `{value}`", expected.join(", "))
49 }
50 }
51
52 impl ::std::fmt::Display for $name {
53 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
54 f.write_str(self.as_str())
55 }
56 }
57
58 impl ::serde::Serialize for $name {
59 fn serialize<S: ::serde::Serializer>(&self, s: S) -> ::std::result::Result<S::Ok, S::Error> {
60 s.serialize_str(self.as_str())
61 }
62 }
63 };
64}
65
66pub mod analytics;
67mod app;
68mod assets;
69pub mod audit;
70pub mod auth;
71pub mod cache;
72pub mod chart;
73mod client_ip;
74mod clock;
75pub mod command;
76mod config;
77pub mod context;
78mod cookies;
79mod counters;
80mod crypto;
81mod csrf;
82pub mod db;
83mod domain;
84mod download;
85mod embedded;
86mod error;
87pub mod events;
88pub mod grid;
89mod health;
90mod htmx;
91pub mod http;
92pub mod i18n;
93pub mod import;
94mod inspector;
95mod live;
96pub mod mail;
97pub mod maintenance;
98mod method;
99mod module;
100mod path;
101pub mod prompt;
102mod provided;
103pub mod queue;
104pub mod rate_limit;
105mod redirect;
106mod registry;
107pub mod report;
108mod request_id;
109mod routing;
110pub mod schedule;
111pub mod security;
112pub mod select;
113pub mod seo;
114mod session;
115pub mod shell;
116pub mod signed;
117mod state;
118pub mod storage;
119#[cfg(test)]
120mod test_logs;
121pub mod testing;
122pub mod timezone;
123pub mod toast;
124pub mod upload;
125pub mod validation;
126pub mod view;
128mod view_filters;
129mod view_stack;
130pub mod webhook;
131
132pub use app::{App, Kernel};
133pub use assets::{ALPINE_VERSION, CALLY_VERSION, HTMX_VERSION};
134pub use auth::{AuthUser, Policy};
135pub use client_ip::{ClientIp, TrustedProxies};
136pub use config::{
137 AnalyticsConfig, CacheStore, Config, CspMode, Environment, LogFormat, SessionDriver,
138};
139pub use cookies::{Cookies, SetCookie};
140pub use crypto::{generate_key, random_token};
141pub use csrf::{CSRF_FIELD, CSRF_HEADER, XSRF_COOKIE, XSRF_HEADER};
142pub use domain::DomainParams;
143pub use download::Download;
144pub use embedded::Embedded;
145pub use error::{Error, Result, abort, abort_if, abort_unless};
146pub use htmx::{Back, Htmx, HxPushUrl, HxRedirect, HxRefresh, HxReswap, HxRetarget, HxTrigger};
147pub use i18n::Lang;
148pub use method::METHOD_FIELD;
149pub use module::Module;
150pub use path::{Found, Path};
151pub use provided::Provided;
152pub use redirect::RedirectExt;
153pub use registry::Registry;
154pub use request_id::RequestId;
155pub use routing::Resource;
156pub(crate) use routing::RouteTable;
157pub use routing::{CurrentRoute, RouteInfo, Routes};
158pub use session::Session;
159pub use state::AppState;
160pub use state::{SentBroadcast, SentNotification};
161pub use toast::{Toast, ToastAction, ToastKind};
162pub use upload::Upload;
163pub use validation::{Errors, KeyValues, Valid, Validate, ValidationError, Validator};
164pub(crate) use view::Views;
165pub use view::{View, view};
166pub use view_filters::{currency_decimals, format_money, format_number};
167
168pub use minijinja::context;
169
170pub use anyhow;
173pub use chrono;
174pub use clap;
175#[cfg(feature = "fake")]
176pub use fake;
177pub use minijinja;
180pub use serde;
181pub use serde_json;
182#[doc(hidden)]
183pub use sqlx as __sqlx;
184pub use tower_http::cors;
186#[cfg(feature = "uuid")]
189pub use uuid;