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
//! Content-hashed static asset bundles.
//!
//! Re-exports the leaf `ferro-bundle` crate and adds the framework-aware
//! [`bundle::serve`](crate::bundle::serve) adapter that maps a [`crate::Request`] to an [`crate::HttpResponse`].
//! Register bundles at boot (or lazily via the `asset!()` macro), then mount
//! [`bundle::serve`](crate::bundle::serve) on `/bundles/{filename}` and on each registered alias path.
//!
//! # Example
//!
//! ```rust,ignore
//! use ferro::bundle::{Bundle, serve as bundle_serve};
//!
//! // Boot-time registration.
//! Bundle::new("app_js", include_bytes!("../assets/app.js"))
//! .content_type("application/javascript");
//!
//! // In your route handler:
//! pub async fn bundle_handler(req: Request) -> Response {
//! Ok(bundle_serve(&req))
//! }
//! ```
pub use ;
use crate::;
/// Dispatch a request to the bundle registry, returning a framework [`HttpResponse`].
///
/// Reads `req.path()` and the `if-none-match` header, delegates to
/// [`ferro_bundle::serve_path`], then maps the returned [`BundleResponse`]
/// (status / headers / body) into a framework [`HttpResponse`]. Mount this
/// function as the handler for `/bundles/{filename}` and each registered alias path.