pub trait BrowserPoolRocketExt {
// Required method
fn into_rocket_data(self) -> SharedBrowserPool;
}Expand description
Extension trait for BrowserPool with Rocket helpers.
Provides convenient methods for integrating with Rocket’s managed state.
§Example
ⓘ
use html2pdf_api::integrations::rocket::BrowserPoolRocketExt;
let pool = BrowserPool::builder()
.factory(Box::new(ChromeBrowserFactory::with_defaults()))
.build()?;
pool.warmup().await?;
// Convert directly to Rocket managed state
let shared_pool = pool.into_rocket_data();
rocket::build()
.manage(shared_pool)
.configure(configure_routes)Required Methods§
Sourcefn into_rocket_data(self) -> SharedBrowserPool
fn into_rocket_data(self) -> SharedBrowserPool
Convert the pool into a shared reference suitable for Rocket’s managed state.
This is equivalent to calling into_shared(), returning an
Arc<Mutex<BrowserPool>> that can be passed to rocket.manage().
§Example
ⓘ
use html2pdf_api::integrations::rocket::BrowserPoolRocketExt;
let pool = BrowserPool::builder()
.factory(Box::new(ChromeBrowserFactory::with_defaults()))
.build()?;
let shared_pool = pool.into_rocket_data();
rocket::build()
.manage(shared_pool)
.mount("/", routes())