Into doesn't works
This commit is contained in:
parent
4abe8310a5
commit
aaf11dd265
@ -249,7 +249,7 @@ impl DatabaseConnection {
|
|||||||
/// Sets a callback to metric this connection
|
/// Sets a callback to metric this connection
|
||||||
pub fn set_metric_callback<F>(&mut self, callback: F)
|
pub fn set_metric_callback<F>(&mut self, callback: F)
|
||||||
where
|
where
|
||||||
F: Into<crate::metric::Callback>,
|
F: Fn(&crate::metric::Info<'_>) + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
#[cfg(feature = "sqlx-mysql")]
|
#[cfg(feature = "sqlx-mysql")]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{future::Future, pin::Pin};
|
use std::{future::Future, pin::Pin, sync::Arc};
|
||||||
|
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
mysql::{MySqlArguments, MySqlConnectOptions, MySqlQueryResult, MySqlRow},
|
mysql::{MySqlArguments, MySqlConnectOptions, MySqlQueryResult, MySqlRow},
|
||||||
@ -202,9 +202,9 @@ impl SqlxMySqlPoolConnection {
|
|||||||
|
|
||||||
pub(crate) fn set_metric_callback<F>(&mut self, callback: F)
|
pub(crate) fn set_metric_callback<F>(&mut self, callback: F)
|
||||||
where
|
where
|
||||||
F: Into<crate::metric::Callback>,
|
F: Fn(&crate::metric::Info<'_>) + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
self.metric_callback = Some(callback.into());
|
self.metric_callback = Some(Arc::new(callback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{future::Future, pin::Pin};
|
use std::{future::Future, pin::Pin, sync::Arc};
|
||||||
|
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
postgres::{PgArguments, PgConnectOptions, PgQueryResult, PgRow},
|
postgres::{PgArguments, PgConnectOptions, PgQueryResult, PgRow},
|
||||||
@ -202,9 +202,9 @@ impl SqlxPostgresPoolConnection {
|
|||||||
|
|
||||||
pub(crate) fn set_metric_callback<F>(&mut self, callback: F)
|
pub(crate) fn set_metric_callback<F>(&mut self, callback: F)
|
||||||
where
|
where
|
||||||
F: Into<crate::metric::Callback>,
|
F: Fn(&crate::metric::Info<'_>) + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
self.metric_callback = Some(callback.into());
|
self.metric_callback = Some(Arc::new(callback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{future::Future, pin::Pin};
|
use std::{future::Future, pin::Pin, sync::Arc};
|
||||||
|
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
sqlite::{SqliteArguments, SqliteConnectOptions, SqliteQueryResult, SqliteRow},
|
sqlite::{SqliteArguments, SqliteConnectOptions, SqliteQueryResult, SqliteRow},
|
||||||
@ -206,9 +206,9 @@ impl SqlxSqlitePoolConnection {
|
|||||||
|
|
||||||
pub(crate) fn set_metric_callback<F>(&mut self, callback: F)
|
pub(crate) fn set_metric_callback<F>(&mut self, callback: F)
|
||||||
where
|
where
|
||||||
F: Into<crate::metric::Callback>,
|
F: Fn(&crate::metric::Info<'_>) + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
self.metric_callback = Some(callback.into());
|
self.metric_callback = Some(Arc::new(callback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user