Crate deadpool_fantoccini

Source
Expand description

deadpool is a dead simple async pool for connections and objects of any type.

This crate implements a deadpool manager for fantoccini.

§Example

use deadpool_fantoccini::{Manager, Pool, PoolShutdown};
use fantoccini::{ClientBuilder, Locator};

#[tokio::main]
async fn main() {
    let manager = Manager::new("http://localhost:4444", ClientBuilder::native());
    let pool = Pool::builder(manager).max_size(5).build().unwrap();

    let mut client = pool.get().await.unwrap();
    client.goto("http://example.org/").await.unwrap();
    let title = client
        .find(Locator::Css("h1"))
        .await
        .unwrap()
        .text()
        .await
        .unwrap();
    assert_eq!(title, "Example Domain");
    drop(client);

    // cleanly close all sessions (all sessions have to be returned to the pool beforehand)
    pool.shutdown().await.unwrap();
}

!

Modules§

native_tlsnative-tls
Type aliases for using this crate with native-tls.
reexports
Reexports of the dependencies of this crate.
rustls_tlsrustls-tls
Type aliases for using this crate with rustls.

Structs§

Manager
deadpool::managed::Manager for creating and recycling fantoccini::Clients.

Traits§

PoolShutdown
Extensions trait used to provide a way to cleanly close all active sessions from a Pool.

Type Aliases§

BuildError
Type alias for using deadpool::managed::BuildError with fantoccini.
CreatePoolError
Type alias for using deadpool::managed::CreatePoolError with fantoccini.
Hook
Type alias for using deadpool::managed::Hook with fantoccini.
HookError
Type alias for using deadpool::managed::HookError with fantoccini.
Object
Type alias for using deadpool::managed::Object with fantoccini.
Pool
Type alias for using deadpool::managed::Pool with fantoccini.
PoolBuilder
Type alias for using deadpool::managed::PoolBuilder with fantoccini.
PoolError
Type alias for using deadpool::managed::PoolError with fantoccini.