forked from launchbadge/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmod.rs
More file actions
34 lines (28 loc) · 823 Bytes
/
mod.rs
File metadata and controls
34 lines (28 loc) · 823 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
25
26
27
28
29
30
31
32
33
34
mod statement_cache;
pub(crate) use statement_cache::StatementCache;
#[cfg(feature = "sqlite")]
use std::fmt::{Debug, Formatter};
#[cfg(feature = "sqlite")]
use std::ops::{Deref, DerefMut};
/// A wrapper for `Fn`s that provides a debug impl that just says "Function"
#[cfg(feature = "sqlite")]
pub(crate) struct DebugFn<F: ?Sized>(pub F);
#[cfg(feature = "sqlite")]
impl<F: ?Sized> Deref for DebugFn<F> {
type Target = F;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[cfg(feature = "sqlite")]
impl<F: ?Sized> DerefMut for DebugFn<F> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
#[cfg(feature = "sqlite")]
impl<F: ?Sized> Debug for DebugFn<F> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("Function").finish()
}
}