Browse Source

Fixed formatting issues

Cesar Rodas 4 months ago
parent
commit
d74a654682
2 changed files with 28 additions and 6 deletions
  1. 14 3
      crates/cdk-sqlite/src/mint/async_rusqlite.rs
  2. 14 3
      crates/cdk-sqlite/src/stmt.rs

+ 14 - 3
crates/cdk-sqlite/src/mint/async_rusqlite.rs

@@ -46,12 +46,20 @@ pub struct Statement(InnerStatement);
 
 impl Statement {
     /// Bind a variable
-    pub fn bind<C: ToString, V: Into<Value>>(self, name: C, value: V) -> Self {
+    pub fn bind<C, V>(self, name: C, value: V) -> Self
+    where
+        C: ToString,
+        V: Into<Value>,
+    {
         Self(self.0.bind(name, value))
     }
 
     /// Bind vec
-    pub fn bind_vec<C: ToString, V: Into<Value>>(self, name: C, value: Vec<V>) -> Self {
+    pub fn bind_vec<C, V>(self, name: C, value: Vec<V>) -> Self
+    where
+        C: ToString,
+        V: Into<Value>,
+    {
         Self(self.0.bind_vec(name, value))
     }
 
@@ -374,7 +382,10 @@ pub trait DatabaseExecutor {
 }
 
 #[inline(always)]
-pub fn query<T: ToString>(sql: T) -> Statement {
+pub fn query<T>(sql: T) -> Statement
+where
+    T: ToString,
+{
     Statement(crate::stmt::Statement::new(sql))
 }
 

+ 14 - 3
crates/cdk-sqlite/src/stmt.rs

@@ -37,7 +37,10 @@ pub struct Statement {
 
 impl Statement {
     /// Creates a new statement
-    pub fn new<T: ToString>(sql: T) -> Self {
+    pub fn new<T>(sql: T) -> Self
+    where
+        T: ToString,
+    {
         Self {
             sql: sql.to_string(),
             ..Default::default()
@@ -46,7 +49,11 @@ impl Statement {
 
     /// Binds a given placeholder to a value.
     #[inline]
-    pub fn bind<C: ToString, V: Into<Value>>(mut self, name: C, value: V) -> Self {
+    pub fn bind<C, V>(mut self, name: C, value: V) -> Self
+    where
+        C: ToString,
+        V: Into<Value>,
+    {
         self.args.push((name.to_string(), value.into()));
         self
     }
@@ -56,7 +63,11 @@ impl Statement {
     /// This will rewrite the function from `:foo` (where value is vec![1, 2, 3]) to `:foo0, :foo1,
     /// :foo2` and binds each value from the value vector accordingly.
     #[inline]
-    pub fn bind_vec<C: ToString, V: Into<Value>>(mut self, name: C, value: Vec<V>) -> Self {
+    pub fn bind_vec<C, V>(mut self, name: C, value: Vec<V>) -> Self
+    where
+        C: ToString,
+        V: Into<Value>,
+    {
         let mut new_sql = String::with_capacity(self.sql.len());
         let target = name.to_string();
         let mut i = 0;