Struct r2d2_postgres::PostgresConnectionManager[][src]

pub struct PostgresConnectionManager<T> { /* fields omitted */ }
Expand description

An r2d2::ManageConnection for postgres::Clients.

Example

use std::thread;
use r2d2_postgres::{postgres::NoTls, PostgresConnectionManager};

fn main() {
    let manager = PostgresConnectionManager::new(
        "host=localhost user=postgres".parse().unwrap(),
        NoTls,
    );
    let pool = r2d2::Pool::new(manager).unwrap();

    for i in 0..10i32 {
        let pool = pool.clone();
        thread::spawn(move || {
            let mut client = pool.get().unwrap();
            client.execute("INSERT INTO foo (bar) VALUES ($1)", &[&i]).unwrap();
        });
    }
}

Implementations

Creates a new PostgresConnectionManager.

Trait Implementations

Formats the value using the given formatter. Read more

The connection type this manager deals with.

The error type returned by Connections.

Attempts to create a new connection.

Determines if the connection is still connected to the database. Read more

Quickly determines if the connection is no longer usable. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.