diff --git a/core/src/lib.rs b/core/src/lib.rs index 04891f19..a2f54d67 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -55,6 +55,7 @@ mod value_type_set; mod sql_types; pub use types::{ + Cloned, Entid, FromRc, KnownEntid, diff --git a/core/src/types.rs b/core/src/types.rs index c7ea58df..da49d7f6 100644 --- a/core/src/types.rs +++ b/core/src/types.rs @@ -72,6 +72,23 @@ impl FromRc for Arc where T: Sized + Clone { } } +// We do this a lot for errors. +pub trait Cloned { + fn cloned(&self) -> T; +} + +impl Cloned for Rc where T: Sized + Clone { + fn cloned(&self) -> T { + (*self.as_ref()).clone() + } +} + +impl Cloned for Arc where T: Sized + Clone { + fn cloned(&self) -> T { + (*self.as_ref()).clone() + } +} + // // Use Rc for values. // diff --git a/query-algebrizer/src/clauses/mod.rs b/query-algebrizer/src/clauses/mod.rs index 1903a62b..7ee8b136 100644 --- a/query-algebrizer/src/clauses/mod.rs +++ b/query-algebrizer/src/clauses/mod.rs @@ -25,12 +25,9 @@ use std::fmt::{ Formatter, }; -use std::ops::{ - Deref, -}; - use mentat_core::{ Attribute, + Cloned, Entid, HasSchema, KnownEntid, @@ -100,17 +97,6 @@ pub use self::inputs::QueryInputs; use Known; -// We do this a lot for errors. -trait Cloned { - fn cloned(&self) -> T; -} - -impl Cloned for ::mentat_core::ValueRc { - fn cloned(&self) -> T { - self.deref().clone() - } -} - trait Contains { fn when_contains T>(&self, k: &K, f: F) -> Option; } diff --git a/query-algebrizer/src/clauses/pattern.rs b/query-algebrizer/src/clauses/pattern.rs index 62aede94..05b08c24 100644 --- a/query-algebrizer/src/clauses/pattern.rs +++ b/query-algebrizer/src/clauses/pattern.rs @@ -9,6 +9,7 @@ // specific language governing permissions and limitations under the License. use mentat_core::{ + Cloned, Entid, HasSchema, TypedValue, @@ -24,8 +25,6 @@ use mentat_query::{ Variable, }; -use super::Cloned; - use clauses::{ ConjoiningClauses, };