Struct ConnectionBuilder

Source
pub struct ConnectionBuilder<Tls>
where Tls: MakeTlsConnect<Socket> + Clone + Send + Sync + 'static, Tls::Stream: Sync + Send, Tls::TlsConnect: Sync + Send, <Tls::TlsConnect as TlsConnect<Socket>>::Future: Send,
{ /* private fields */ }
Expand description

Implementations§

Source§

impl<Tls> ConnectionBuilder<Tls>
where Tls: MakeTlsConnect<Socket> + Clone + Send + Sync + 'static, Tls::Stream: Sync + Send, Tls::TlsConnect: Sync + Send, <Tls::TlsConnect as TlsConnect<Socket>>::Future: Send,

Source

pub fn tls<NewTls>(self, tls: NewTls) -> ConnectionBuilder<NewTls>
where NewTls: MakeTlsConnect<Socket> + Clone + Send + Sync + 'static, NewTls::Stream: Sync + Send, NewTls::TlsConnect: Sync + Send, <NewTls::TlsConnect as TlsConnect<Socket>>::Future: Send,

Set the Tls method.

Use either postgres-openssl or postgres-nativ-tls and their respective documentation. This function accepts the same types as tokio-postgres.

Source

pub fn max_pool_size(self, n: usize) -> Self

Set the maximum size of the connection pool, i.e. the maximum amount of concurrent connections to the database server.

The default is num_cpus * 4, ignoring hyperthreading, etc.

Source

pub fn connect(self) -> Result<(), Error>

Finish the setup and build the pool.

Fails if

  • the url couldn’t be parsed, or
  • some other configuration error has been made.

Auto Trait Implementations§

§

impl<Tls> Freeze for ConnectionBuilder<Tls>
where Tls: Freeze,

§

impl<Tls> RefUnwindSafe for ConnectionBuilder<Tls>
where Tls: RefUnwindSafe,

§

impl<Tls> Send for ConnectionBuilder<Tls>

§

impl<Tls> Sync for ConnectionBuilder<Tls>

§

impl<Tls> Unpin for ConnectionBuilder<Tls>
where Tls: Unpin,

§

impl<Tls> UnwindSafe for ConnectionBuilder<Tls>
where Tls: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V