1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! A small, synchronous entrypoint for Clamp applications.
//!
//! ```
//! use rustclamp::prelude::*;
//!
//! let answer = Clamp::run(|| 42);
//! assert_eq!(answer, 42);
//! ```
#![forbid(unsafe_code)]
#![deny(missing_docs)]
#[cfg(feature = "build")]
pub mod build;
#[cfg(feature = "cache")]
pub mod cache;
#[cfg(feature = "cli")]
pub mod cli;
#[cfg(feature = "config")]
pub mod config;
#[cfg(feature = "crypto")]
pub mod crypto;
#[cfg(feature = "db")]
pub mod db;
pub mod error;
#[cfg(feature = "log")]
pub mod log;
#[cfg(feature = "mail")]
pub mod mail;
#[cfg(feature = "metrics")]
pub mod metrics;
#[cfg(feature = "queue")]
pub mod queue;
#[cfg(feature = "redis")]
pub mod redis;
#[cfg(feature = "schedule")]
pub mod schedule;
#[cfg(feature = "storage")]
pub mod storage;
#[cfg(feature = "time")]
pub mod time;
#[cfg(feature = "uuid")]
pub mod uuid;
#[cfg(feature = "web")]
pub mod web;
/// Entrypoints for running a Clamp application.
///
/// The closure entrypoint has no application state or required runtime.
pub struct Clamp;
impl Clamp {
/// Calls `run` once on the current thread and returns its result unchanged.
///
/// The closure may borrow local data or consume owned captures; it need not
/// be `Send` or `'static`. Errors are ordinary return values. Panics propagate
/// according to the application's panic strategy, just as a direct call does.
///
/// This entrypoint adds no allocation, background work, composition, or
/// lifecycle handling. Returning a future does not poll or execute it.
#[inline]
pub fn run<F, R>(run: F) -> R
where
F: FnOnce() -> R,
{
run()
}
}
/// The small set of imports needed by a basic Clamp application.
pub mod prelude {
pub use crate::Clamp;
}