[][src]Struct r2d2_postgres::PostgresConnectionManager

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

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

impl<T> PostgresConnectionManager<T> where
    T: MakeTlsConnect<Socket> + Clone + 'static + Sync + Send,
    T::TlsConnect: Send,
    T::Stream: Send,
    <T::TlsConnect as TlsConnect<Socket>>::Future: Send
[src]

pub fn new(config: Config, tls_connector: T) -> PostgresConnectionManager<T>[src]

Creates a new PostgresConnectionManager.

Trait Implementations

impl<T: Debug> Debug for PostgresConnectionManager<T>[src]

impl<T> ManageConnection for PostgresConnectionManager<T> where
    T: MakeTlsConnect<Socket> + Clone + 'static + Sync + Send,
    T::TlsConnect: Send,
    T::Stream: Send,
    <T::TlsConnect as TlsConnect<Socket>>::Future: Send
[src]

type Connection = Client

The connection type this manager deals with.

type Error = Error

The error type returned by Connections.

Auto Trait Implementations

impl<T> !RefUnwindSafe for PostgresConnectionManager<T>[src]

impl<T> Send for PostgresConnectionManager<T> where
    T: Send
[src]

impl<T> Sync for PostgresConnectionManager<T> where
    T: Sync
[src]

impl<T> Unpin for PostgresConnectionManager<T> where
    T: Unpin
[src]

impl<T> !UnwindSafe for PostgresConnectionManager<T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,