diff --git a/Cargo.lock b/Cargo.lock index ca0e45f1..cabb1cad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1585,7 +1585,6 @@ dependencies = [ "schemars", "serde", "serde_json", - "these", "thiserror", ] diff --git a/crates/mongodb-support/Cargo.toml b/crates/mongodb-support/Cargo.toml index a749ac9f..dbd6cb2e 100644 --- a/crates/mongodb-support/Cargo.toml +++ b/crates/mongodb-support/Cargo.toml @@ -10,7 +10,6 @@ indexmap = { version = "1", features = ["serde"] } # must match the version that schemars = "^0.8.12" serde = { version = "1", features = ["derive"] } serde_json = "1" -these = "2.0.0" thiserror = "1" [dev-dependencies] diff --git a/crates/mongodb-support/src/align.rs b/crates/mongodb-support/src/align.rs index da61f5c6..25553f0f 100644 --- a/crates/mongodb-support/src/align.rs +++ b/crates/mongodb-support/src/align.rs @@ -1,65 +1,5 @@ use indexmap::IndexMap; use std::hash::Hash; -use these::These::{self, *}; - -pub fn align(ts: IndexMap, mut us: IndexMap) -> IndexMap> -where - K: Hash + Eq, -{ - let mut result: IndexMap> = IndexMap::new(); - - for (k, t) in ts { - match us.swap_remove(&k) { - None => result.insert(k, This(t)), - Some(u) => result.insert(k, Both(t, u)), - }; - } - - for (k, u) in us { - result.insert(k, That(u)); - } - result -} - -pub fn align_with(ts: IndexMap, mut us: IndexMap, f: F) -> IndexMap -where - K: Hash + Eq, - F: Fn(V, V) -> V, -{ - let mut result: IndexMap = IndexMap::new(); - - for (k, t) in ts { - match us.swap_remove(&k) { - None => result.insert(k, t), - Some(u) => result.insert(k, f(t, u)), - }; - } - - for (k, u) in us { - result.insert(k, u); - } - result -} - -// pub fn align_with_result(ts: IndexMap, mut us: IndexMap, f: F) -> Result, E> -// where -// K: Hash + Eq, -// F: Fn(V, V) -> Result, -// { -// let mut result: IndexMap = IndexMap::new(); - -// for (k, t) in ts { -// match us.swap_remove(&k) { -// None => result.insert(k, t), -// Some(u) => result.insert(k, f(t, u)?), -// }; -// } - -// for (k, u) in us { -// result.insert(k, u); -// } -// Ok(result) -// } pub fn align_with_result(ts: IndexMap, mut us: IndexMap, ft: FT, fu: FU, ftu: FTU) -> Result, E> where