diff --git a/Cargo.toml b/Cargo.toml index b15cbe67..d5d7235b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,9 @@ path = "query-projector" [dependencies.mentat_query_pull] path = "query-pull" +[dependencies.query_pull_traits] +path = "query-pull-traits" + [dependencies.mentat_query_sql] path = "query-sql" diff --git a/query-projector/Cargo.toml b/query-projector/Cargo.toml index 4a4daa9e..571989f5 100644 --- a/query-projector/Cargo.toml +++ b/query-projector/Cargo.toml @@ -36,6 +36,9 @@ path = "../query-algebrizer" [dependencies.mentat_query_pull] path = "../query-pull" +[dependencies.query_pull_traits] +path = "../query-pull-traits" + [dependencies.mentat_query_sql] path = "../query-sql" diff --git a/query-projector/src/errors.rs b/query-projector/src/errors.rs index b86c22df..ae719242 100644 --- a/query-projector/src/errors.rs +++ b/query-projector/src/errors.rs @@ -19,7 +19,9 @@ use db_traits::errors::DbError; use mentat_query::{ PlainSymbol, }; -use mentat_query_pull; +use query_pull_traits::errors::{ + PullError, +}; use aggregates::{ SimpleAggregationOp, @@ -74,7 +76,7 @@ pub enum ProjectorError { DbError(#[cause] DbError), #[fail(display = "{}", _0)] - PullError(#[cause] mentat_query_pull::PullError), + PullError(#[cause] PullError), } impl From for ProjectorError { @@ -89,8 +91,8 @@ impl From for ProjectorError { } } -impl From for ProjectorError { - fn from(error: mentat_query_pull::PullError) -> ProjectorError { +impl From for ProjectorError { + fn from(error: PullError) -> ProjectorError { ProjectorError::PullError(error) } } diff --git a/query-projector/src/lib.rs b/query-projector/src/lib.rs index d4538aca..57336b5d 100644 --- a/query-projector/src/lib.rs +++ b/query-projector/src/lib.rs @@ -22,6 +22,7 @@ extern crate mentat_db; // For value conversion. extern crate mentat_query; extern crate mentat_query_algebrizer; extern crate mentat_query_pull; +extern crate query_pull_traits; extern crate mentat_query_sql; extern crate mentat_sql; diff --git a/query-pull-traits/Cargo.toml b/query-pull-traits/Cargo.toml new file mode 100644 index 00000000..9bb793ee --- /dev/null +++ b/query-pull-traits/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "query_pull_traits" +version = "0.0.1" +workspace = ".." + +[lib] +name = "query_pull_traits" +path = "lib.rs" + +[dependencies] +failure = "0.1.1" +failure_derive = "0.1.1" + +[dependencies.core_traits] +path = "../core-traits" + +[dependencies.db_traits] +path = "../db-traits" diff --git a/query-pull/src/errors.rs b/query-pull-traits/errors.rs similarity index 100% rename from query-pull/src/errors.rs rename to query-pull-traits/errors.rs diff --git a/query-pull-traits/lib.rs b/query-pull-traits/lib.rs new file mode 100644 index 00000000..bcb762dd --- /dev/null +++ b/query-pull-traits/lib.rs @@ -0,0 +1,18 @@ +// Copyright 2018 Mozilla +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use +// this file except in compliance with the License. You may obtain a copy of the +// License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for the +// specific language governing permissions and limitations under the License. + +extern crate failure; +#[macro_use] +extern crate failure_derive; + +extern crate core_traits; +extern crate db_traits; + +pub mod errors; diff --git a/query-pull/Cargo.toml b/query-pull/Cargo.toml index 238acd68..299f2860 100644 --- a/query-pull/Cargo.toml +++ b/query-pull/Cargo.toml @@ -5,7 +5,9 @@ workspace = ".." [dependencies] failure = "0.1.1" -failure_derive = "0.1.1" + +[dependencies.query_pull_traits] +path = "../query-pull-traits" [dependencies.rusqlite] version = "0.13" diff --git a/query-pull/src/lib.rs b/query-pull/src/lib.rs index 1622292c..213822bf 100644 --- a/query-pull/src/lib.rs +++ b/query-pull/src/lib.rs @@ -58,10 +58,6 @@ ///! ``` extern crate failure; - -#[macro_use] -extern crate failure_derive; - extern crate rusqlite; extern crate mentat_core; @@ -69,6 +65,7 @@ extern crate core_traits; extern crate mentat_db; extern crate db_traits; extern crate mentat_query; +extern crate query_pull_traits; extern crate mentat_query_algebrizer; extern crate mentat_query_sql; extern crate mentat_sql; @@ -105,9 +102,7 @@ use mentat_query::{ PullConcreteAttribute, }; -pub mod errors; - -pub use errors::{ +use query_pull_traits::errors::{ PullError, Result, }; diff --git a/src/errors.rs b/src/errors.rs index 23bc9549..43716e8e 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -30,7 +30,9 @@ use db_traits::errors::DbError; use mentat_query; use mentat_query_algebrizer; use mentat_query_projector; -use mentat_query_pull; +use query_pull_traits::errors::{ + PullError, +}; use mentat_sql; #[cfg(feature = "syncable")] @@ -107,7 +109,7 @@ pub enum MentatError { ProjectorError(#[cause] mentat_query_projector::ProjectorError), #[fail(display = "{}", _0)] - PullError(#[cause] mentat_query_pull::PullError), + PullError(#[cause] PullError), #[fail(display = "{}", _0)] SQLError(#[cause] mentat_sql::SQLError), @@ -153,8 +155,8 @@ impl From for MentatError { } } -impl From for MentatError { - fn from(error: mentat_query_pull::PullError) -> MentatError { +impl From for MentatError { + fn from(error: PullError) -> MentatError { MentatError::PullError(error) } } diff --git a/src/lib.rs b/src/lib.rs index 51d4adfd..151e277f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,7 @@ extern crate mentat_query; extern crate mentat_query_algebrizer; extern crate mentat_query_projector; extern crate mentat_query_pull; +extern crate query_pull_traits; extern crate mentat_query_translator; extern crate mentat_sql; @@ -144,7 +145,7 @@ pub use mentat_query_projector::{ BindingTuple, ProjectorError, }; -pub use mentat_query_pull::PullError; +pub use query_pull_traits::errors::PullError; pub use mentat_sql::SQLError; pub mod conn;