create_pool_data_from_arc

Function create_pool_data_from_arc 

Source
pub fn create_pool_data_from_arc(
    pool: Arc<Mutex<BrowserPool>>,
) -> SharedBrowserPool
Expand description

Create Rocket managed state from an Arc reference.

Use this when you need to keep a reference to the pool for shutdown.

§Parameters

  • pool - Arc reference to the shared browser pool.

§Returns

Cloned SharedBrowserPool ready for use with rocket.manage().

§Example

use html2pdf_api::integrations::rocket::create_pool_data_from_arc;

let shared_pool = pool.into_shared();
let pool_for_shutdown = Arc::clone(&shared_pool);
let pool_data = create_pool_data_from_arc(shared_pool);

// Use pool_data in rocket.manage()
// Use pool_for_shutdown for cleanup in shutdown fairing