[−][src]Struct r2d2_postgres::PostgresConnectionManager
An r2d2::ManageConnection
for postgres::Client
s.
Example
use std::thread; use postgres::{NoTls, Client}; use r2d2_postgres::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(); }); } }
Methods
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]
T: MakeTlsConnect<Socket> + Clone + 'static + Sync + Send,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
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]
T: MakeTlsConnect<Socket> + Clone + 'static + Sync + Send,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
Auto Trait Implementations
impl<T> !RefUnwindSafe for PostgresConnectionManager<T>
impl<T> Send for PostgresConnectionManager<T> where
T: Send,
T: Send,
impl<T> Sync for PostgresConnectionManager<T> where
T: Sync,
T: Sync,
impl<T> Unpin for PostgresConnectionManager<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for PostgresConnectionManager<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = !
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,