Skip to main content

jerrycan_core/
lib.rs

1//! Core framework of the jerrycan platform: routing, extractors, dependency
2//! injection, middleware. Generated apps import this through the `jerrycan`
3//! facade crate — see <https://jerrycan.cc>
4#![forbid(unsafe_code)]
5
6pub mod app;
7pub mod clock;
8pub mod cors;
9pub mod dep;
10pub mod error;
11pub mod extract;
12pub mod handler;
13pub mod middleware;
14pub mod module;
15pub mod multipart;
16pub mod response;
17pub mod router;
18mod serve;
19pub mod test_client;
20
21pub use app::{App, BuiltApp, Extension};
22pub use clock::Clock;
23pub use cors::{CorsConfig, CorsOrigins};
24pub use dep::{Dep, TaskContext};
25pub use error::{Error, Result};
26pub use extract::{FromRequest, Headers, Path, Query, RawBody, RequestCtx};
27pub use handler::Handler;
28pub use middleware::{Middleware, MiddlewareFuture, Next};
29pub use module::Module;
30pub use multipart::Multipart;
31pub use response::{
32    BodyError, BodySender, Created, IntoResponse, JcBody, Json, NoContent, Redirect, Response,
33    StreamBody,
34};
35pub use router::{MethodRouter, delete, get, patch, post, put};
36pub use test_client::{TestApp, TestPart, TestResponse};
37
38/// Re-exported so apps and tests never add `http` to their own Cargo.toml.
39pub use http;
40
41/// Re-exported for webhook recipes that parse `application/x-www-form-urlencoded`
42/// bodies (e.g. Twilio's signed form params) without a separate dependency.
43pub use serde_urlencoded;
44
45/// One import for generated code: `use jerrycan::prelude::*;`
46pub mod prelude {
47    pub use crate::{
48        App, Clock, CorsConfig, CorsOrigins, Created, Dep, Error, Extension, Headers, IntoResponse,
49        Json, Middleware, MiddlewareFuture, Module, Multipart, Next, NoContent, Path, Query,
50        RawBody, Redirect, RequestCtx, Result, StreamBody, TestApp, TestPart, delete, get, patch,
51        post, put,
52    };
53}