mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 05:11:13 +00:00
feat(core): add ConnectOptions::parse for convenience
This commit is contained in:
parent
6c8d68e9d0
commit
8562dba0dc
@ -11,6 +11,12 @@ where
|
||||
Rt: Runtime,
|
||||
Self::Connection: crate::Connection<Rt, Options = Self> + Connection<Rt>,
|
||||
{
|
||||
/// Parse a connection URL into connection options.
|
||||
#[inline]
|
||||
fn parse(url: &str) -> crate::Result<Self> {
|
||||
<Self as crate::ConnectOptions<Rt>>::parse(url)
|
||||
}
|
||||
|
||||
/// Establish a connection to the database.
|
||||
///
|
||||
/// For detailed information, refer to the asynchronous version of
|
||||
|
||||
@ -12,6 +12,11 @@ where
|
||||
{
|
||||
type Connection: Connection<Rt> + ?Sized;
|
||||
|
||||
/// Parse a connection URL into connection options.
|
||||
fn parse(url: &str) -> crate::Result<Self> {
|
||||
url.parse()
|
||||
}
|
||||
|
||||
/// Establish a new connection to the database.
|
||||
#[cfg(feature = "async")]
|
||||
fn connect(&self) -> futures_util::future::BoxFuture<'_, crate::Result<Self::Connection>>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user