1pub mod statement_cache;
2pub mod ustr;
3pub mod scan;
4pub mod crud;
5
6
7use std::fmt::{Debug, Formatter};
8use std::ops::{Deref, DerefMut};
9
10pub struct DebugFn<F: ?Sized>(pub F);
12
13impl<F: ?Sized> Deref for DebugFn<F> {
14 type Target = F;
15
16 fn deref(&self) -> &Self::Target {
17 &self.0
18 }
19}
20
21impl<F: ?Sized> DerefMut for DebugFn<F> {
22 fn deref_mut(&mut self) -> &mut Self::Target {
23 &mut self.0
24 }
25}
26
27impl<F: ?Sized> Debug for DebugFn<F> {
28 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
29 f.debug_tuple("Function").finish()
30 }
31}
32
33pub fn to_snake_name(name: &str) -> String {
34 let chs = name.chars();
35 let mut new_name = String::new();
36 let mut index = 0;
37 let chs_len = name.len();
38 for x in chs {
39 if x.is_uppercase() {
40 if index != 0 && (index + 1) != chs_len {
41 new_name.push_str("_");
42 }
43 new_name.push_str(x.to_lowercase().to_string().as_str());
44 } else {
45 new_name.push(x);
46 }
47 index += 1;
48 }
49 return new_name;
50}