[−][src]Struct c3p0_pool_pg::r2d2::PostgresConnectionManager
An r2d2::ManageConnection
for postgres::Connection
s.
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]
params: T,
ssl_mode: TlsMode
) -> Result<PostgresConnectionManager, Error> where
T: IntoConnectParams,
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 Connection
s.
fn connect(&self) -> Result<Connection, Error>
[src]
fn is_valid(&self, conn: &mut Connection) -> Result<(), Error>
[src]
fn has_broken(&self, conn: &mut Connection) -> bool
[src]
impl Debug for PostgresConnectionManager
[src]
Auto Trait Implementations
impl Unpin for PostgresConnectionManager
impl Send for PostgresConnectionManager
impl Sync for PostgresConnectionManager
impl !RefUnwindSafe for PostgresConnectionManager
impl !UnwindSafe for PostgresConnectionManager
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self