We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc52f84 commit 0624cd6Copy full SHA for 0624cd6
src/lib.rs
@@ -218,11 +218,19 @@ impl IntoConnectParams for Url {
218
}
219
220
/// Trait for types that can handle Postgres notice messages
221
+///
222
+/// It is implemented for all `Send + FnMut(DbError)` closures.
223
pub trait HandleNotice: Send {
224
/// Handle a Postgres notice message
225
fn handle_notice(&mut self, notice: DbError);
226
227
228
+impl<F: Send + FnMut(DbError)> HandleNotice for F {
229
+ fn handle_notice(&mut self, notice: DbError) {
230
+ self(notice)
231
+ }
232
+}
233
+
234
/// A notice handler which logs at the `info` level.
235
///
236
/// This is the default handler used by a `Connection`.
0 commit comments