BrowserPoolState

Type Alias BrowserPoolState 

Source
pub type BrowserPoolState<'r> = &'r State<SharedBrowserPool>;
Expand description

Type alias for Rocket State wrapper around the shared pool.

Use this type in your handler parameters for automatic extraction:

use rocket::State;
use html2pdf_api::integrations::rocket::BrowserPoolState;

#[get("/handler")]
fn handler(pool: BrowserPoolState<'_>) -> &'static str {
    let pool_guard = pool.lock().unwrap();
    let browser = pool_guard.get().unwrap();
    // ...
    "done"
}

§Note

In Rocket, State<T> is accessed as a reference in handlers, so this type alias represents the borrowed form.