Trait TBuilder

Source
pub trait TBuilder:
    Sized
    + Send
    + Sync
    + 'static {
    type Target: Send + Sync + 'static;

    // Required methods
    fn available_params() -> &'static [&'static str];
    fn from_dsn<D: IntoDsn>(dsn: D) -> RawResult<Self>;
    fn client_version() -> &'static str;
    fn ping(&self, _: &mut Self::Target) -> RawResult<()>;
    fn ready(&self) -> bool;
    fn build(&self) -> RawResult<Self::Target>;
}
Expand description

A struct is Connectable when it can be build from a Dsn.

Required Associated Types§

Source

type Target: Send + Sync + 'static

Required Methods§

Source

fn available_params() -> &'static [&'static str]

A list of parameters available in DSN.

Source

fn from_dsn<D: IntoDsn>(dsn: D) -> RawResult<Self>

Connect with dsn without connection checking.

Source

fn client_version() -> &'static str

Get client version.

Source

fn ping(&self, _: &mut Self::Target) -> RawResult<()>

Check a connection is still alive.

Source

fn ready(&self) -> bool

Check if it’s ready to connect.

In most cases, just return true. r2d2 will use this method to check if it’s valid to create a connection. Just check the address is ready to connect.

Source

fn build(&self) -> RawResult<Self::Target>

Create a new connection from this struct.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§