forked from transact-rs/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.rs
More file actions
24 lines (21 loc) · 776 Bytes
/
Copy pathoptions.rs
File metadata and controls
24 lines (21 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Provides the [`ConnectOptions`] trait for configuring a new connection.
use crate::connection::Connection;
use crate::error::Error;
use futures_core::future::BoxFuture;
use std::fmt::Debug;
use std::str::FromStr;
/// Connection options for configuring a new connection.
///
/// Can be parsed from a semi-universal connection URI format of the form:
///
/// ```text
/// driver://user:pass@host:port/database?param1=value1¶m2=value2
/// ```
///
pub trait ConnectOptions: 'static + Send + Sync + FromStr<Err = Error> + Debug {
type Connection: Connection + ?Sized;
/// Establish a new database connection with the options specified by `self`.
fn connect(&self) -> BoxFuture<'_, Result<Self::Connection, Error>>
where
Self::Connection: Sized;
}