Преглед изворни кода

Interface type fix for get_one_by_multi.

Kestrel пре 2 година
родитељ
комит
0045fe030c
3 измењених фајлова са 5 додато и 5 уклоњено
  1. 1 1
      microrm/Cargo.toml
  2. 3 2
      microrm/src/lib.rs
  3. 1 2
      microrm/src/query.rs

+ 1 - 1
microrm/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "microrm"
-version = "0.2.0"
+version = "0.2.1"
 edition = "2021"
 license = "BSD-4-Clause"
 authors = ["Kestrel <kestrel@flying-kestrel.ca>"]

+ 3 - 2
microrm/src/lib.rs

@@ -205,8 +205,9 @@ pub struct DBPool<'a> {
     // however we assume sqlite is operating in serialized mode, which means
     // that it is in fact both `Send` and `Sync`
     db: &'a DB,
-    // we carefully maintain the invariant here that only the thread with the
-    // given `ThreadId` accesses the QueryInterface part of the pair
+    // we carefully maintain the invariant here that only the thread with the given `ThreadId`
+    // accesses the QueryInterface part of the pair, which means that despite the fact that
+    // QueryInterface is neither Send nor Sync can be dismissed in this Send and Sync container
     qi: std::sync::RwLock<Vec<(std::thread::ThreadId, &'a QueryInterface<'a>)>>,
 }
 

+ 1 - 2
microrm/src/query.rs

@@ -177,11 +177,10 @@ impl<'l> QueryInterface<'l> {
     pub fn get_one_by_multi<
         T: Entity<Column = C>,
         C: EntityColumns<Entity = T>,
-        V: crate::model::Modelable,
     >(
         &self,
         c: &[C],
-        val: &[V],
+        val: &[&dyn crate::model::Modelable],
     ) -> Option<WithID<T>> {
         let table_name = <T as Entity>::table_name();