[][src]Struct c3p0_pool_pg::r2d2::PostgresConnectionManager

pub struct PostgresConnectionManager { /* fields omitted */ }

An r2d2::ManageConnection for postgres::Connections.

Example

extern crate r2d2;
extern crate r2d2_postgres;

use std::thread;
use r2d2_postgres::{TlsMode, PostgresConnectionManager};

fn main() {
    let manager = PostgresConnectionManager::new("postgres://postgres@localhost",
                                                 TlsMode::None).unwrap();
    let pool = r2d2::Pool::new(manager).unwrap();

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

Methods

impl PostgresConnectionManager[src]

pub fn new<T>(
    params: T,
    ssl_mode: TlsMode
) -> Result<PostgresConnectionManager, Error> where
    T: IntoConnectParams
[src]

Creates a new PostgresConnectionManager.

See postgres::Connection::connect for a description of the parameter types.

Trait Implementations

impl ManageConnection for PostgresConnectionManager[src]

type Connection = Connection

The connection type this manager deals with.

type Error = Error

The error type returned by Connections.

impl Debug for PostgresConnectionManager[src]

Auto Trait Implementations

Blanket Implementations

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self