[−][src]Struct r2d2_postgres::PostgresConnectionManager
An r2d2::ManageConnection
for postgres::Client
s.
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]
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,
type Connection = Client
The connection type this manager deals with.
type Error = Error
The error type returned by Connection
s.
pub fn connect(&self) -> Result<Client, Error>
[src]
pub fn is_valid(&self, client: &mut Client) -> Result<(), Error>
[src]
pub fn has_broken(&self, client: &mut Client) -> bool
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for PostgresConnectionManager<T>
[src]
impl<T> Send for PostgresConnectionManager<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for PostgresConnectionManager<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for PostgresConnectionManager<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> !UnwindSafe for PostgresConnectionManager<T>
[src]
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,
pub 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 = Infallible
The type returned in the event of a conversion error.
pub 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.
pub 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>,