Skip to main content

PoolBuilder

Struct PoolBuilder 

Source
pub struct PoolBuilder { /* private fields */ }
Expand description

Connection pool builder

§Example

let pool = PoolBuilder::default() .with_database("default") .with_username("default") .with_password("") .add_addr("www.example.com:9000") .build() .unwrap();

Implementations§

Source§

impl PoolBuilder

Source

pub fn with_compression(self) -> Self

Set compression option This make connection use LZ4 compression for block data transfer

Source

pub fn with_ping(self) -> Self

If set, this option make connection check server availability after it is received from pool.

Source

pub fn with_pool(self, min: u16, max: u16) -> Self

Set connection pool boundaries min - set the number of idle connection that the pool can keep up to max - set maximum number of connection that pool can issued

Source

pub fn with_username(self, value: impl ToString) -> Self

Set the username that is used in authentication

Source

pub fn with_database(self, value: impl ToString) -> Self

Set the default database that is used in query processing if the query doesn’t explicitly specify another database name

Source

pub fn with_password(self, value: impl ToString) -> Self

Set password that is used in authentication

Source

pub fn add_addr(self, value: impl ToString) -> Self

Set server host address.

Address must have domain name and port number

§Example

PoolBuilder::new() .with_addr('example1.com:9000') .with_addr('example2.com:9000'); Connection pool can have multiple addresses In this case next connection randomly chooses any available one if it’s reachable

Source

pub fn build(self) -> Result<Pool>

Convert the Builder into Pool using specified options. Note! Created Pool does not have connection. First connection will be created by executing pool.connection()

Trait Implementations§

Source§

impl Default for PoolBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl TryFrom<PoolBuilder> for Options

Source§

type Error = UrlError

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

fn try_from(value: PoolBuilder) -> Result<Self, UrlError>

Performs the conversion.

Auto Trait Implementations§

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, 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