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
//! Web framework integrations.
//!
//! This module provides optional integrations with popular Rust web frameworks,
//! making it easier to use `BrowserPool` in your web applications.
//!
//! # Available Integrations
//!
//! | Framework | Feature Flag | Module |
//! |-----------|--------------|--------|
//! | Actix-web | `actix-integration` | `actix` |
//! | Rocket | `rocket-integration` | `rocket` |
//! | Axum | `axum-integration` | `axum` |
//!
//! # Enabling Integrations
//!
//! Add the desired feature to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! html2pdf-api = { version = "0.1", features = ["actix-integration"] }
//! ```
//!
//! # Common Pattern
//!
//! All integrations follow a similar pattern:
//!
//! 1. Create a `BrowserPool` during application startup
//! 2. Convert to shared state using `into_shared()`
//! 3. Register with your framework's state management
//! 4. Extract the pool in handlers and use `pool.get()`
//!
//! # Example (Generic Pattern)
//!
//! ```rust,ignore
//! use html2pdf_api::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // 1. Create pool
//! let pool = BrowserPool::builder()
//! .factory(Box::new(ChromeBrowserFactory::with_defaults()))
//! .build()?;
//!
//! // 2. Warmup
//! pool.warmup().await?;
//!
//! // 3. Convert to shared state
//! let shared_pool = pool.into_shared();
//!
//! // 4. Pass to your web framework...
//!
//! Ok(())
//! }
//! ```