Skip to main content

rbdc/common/
mod.rs

1mod statement_cache;
2
3pub use crate::types::*;
4
5pub use statement_cache::StatementCache;
6use std::fmt::{Debug, Formatter};
7use std::ops::{Deref, DerefMut};
8
9/// A wrapper for `Fn`s that provides a debug impl that just says "Function"
10pub struct DebugFn<F: ?Sized>(pub F);
11
12impl<F: ?Sized> Deref for DebugFn<F> {
13    type Target = F;
14
15    fn deref(&self) -> &Self::Target {
16        &self.0
17    }
18}
19
20impl<F: ?Sized> DerefMut for DebugFn<F> {
21    fn deref_mut(&mut self) -> &mut Self::Target {
22        &mut self.0
23    }
24}
25
26impl<F: ?Sized> Debug for DebugFn<F> {
27    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
28        f.debug_tuple("Function").finish()
29    }
30}