Part 1: Move public errors into public-traits

This commit is contained in:
Grisha Kruglov 2018-08-08 15:58:55 -07:00 committed by Grisha Kruglov
parent c00e14f5ff
commit e9398dd50d
10 changed files with 86 additions and 11 deletions

View file

@ -30,7 +30,6 @@ rustc_version = "0.2"
[dependencies] [dependencies]
chrono = "0.4" chrono = "0.4"
failure = "0.1.1" failure = "0.1.1"
failure_derive = "0.1.1"
lazy_static = "0.2" lazy_static = "0.2"
time = "0.1" time = "0.1"
uuid = { version = "0.5", features = ["v4", "serde"] } uuid = { version = "0.5", features = ["v4", "serde"] }
@ -82,6 +81,9 @@ path = "query-sql"
[dependencies.sql_traits] [dependencies.sql_traits]
path = "sql-traits" path = "sql-traits"
[dependencies.public_traits]
path = "public-traits"
[dependencies.mentat_tolstoy] [dependencies.mentat_tolstoy]
path = "tolstoy" path = "tolstoy"
optional = true optional = true

45
public-traits/Cargo.toml Normal file
View file

@ -0,0 +1,45 @@
[package]
name = "public_traits"
version = "0.0.1"
workspace = ".."
[lib]
name = "public_traits"
path = "lib.rs"
[features]
default = ["syncable"]
syncable = ["tolstoy_traits"]
[dependencies]
failure = "0.1.1"
failure_derive = "0.1.1"
[dependencies.rusqlite]
version = "0.13"
features = ["limits"]
[dependencies.edn]
path = "../edn"
[dependencies.core_traits]
path = "../core-traits"
[dependencies.db_traits]
path = "../db-traits"
[dependencies.query_algebrizer_traits]
path = "../query-algebrizer-traits"
[dependencies.query_projector_traits]
path = "../query-projector-traits"
[dependencies.query_pull_traits]
path = "../query-pull-traits"
[dependencies.sql_traits]
path = "../sql-traits"
[dependencies.tolstoy_traits]
path = "../tolstoy-traits"
optional = true

26
public-traits/lib.rs Normal file
View file

@ -0,0 +1,26 @@
// 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 rusqlite;
extern crate edn;
extern crate core_traits;
extern crate db_traits;
extern crate query_pull_traits;
extern crate query_projector_traits;
extern crate query_algebrizer_traits;
extern crate tolstoy_traits;
extern crate sql_traits;
pub mod errors;

View file

@ -97,7 +97,7 @@ use entity_builder::{
TermBuilder, TermBuilder,
}; };
use errors::{ use public_traits::errors::{
Result, Result,
MentatError, MentatError,
}; };

View file

@ -80,7 +80,7 @@ use conn::{
InProgress, InProgress,
}; };
use errors::{ use public_traits::errors::{
Result, Result,
}; };

View file

@ -10,8 +10,6 @@
#![recursion_limit="128"] #![recursion_limit="128"]
#[macro_use]
extern crate failure_derive;
extern crate failure; extern crate failure;
#[macro_use] #[macro_use]
@ -34,6 +32,8 @@ extern crate mentat_query_pull;
extern crate query_pull_traits; extern crate query_pull_traits;
extern crate sql_traits; extern crate sql_traits;
extern crate mentat_sql; extern crate mentat_sql;
#[macro_use]
extern crate public_traits;
#[cfg(feature = "syncable")] #[cfg(feature = "syncable")]
extern crate mentat_tolstoy; extern crate mentat_tolstoy;
@ -130,9 +130,8 @@ macro_rules! kw {
}; };
} }
#[macro_use] pub use public_traits::errors;
pub mod errors; pub use public_traits::errors::{
pub use errors::{
MentatError, MentatError,
Result, Result,
}; };

View file

@ -76,7 +76,7 @@ pub use mentat_query_projector::{
RelResult, RelResult,
}; };
use errors::{ use public_traits::errors::{
MentatError, MentatError,
Result, Result,
}; };

View file

@ -36,7 +36,7 @@ use ::{
Variable, Variable,
}; };
use errors::{ use public_traits::errors::{
MentatError, MentatError,
Result, Result,
}; };

View file

@ -59,7 +59,10 @@ use conn::{
Syncable, Syncable,
}; };
use errors::*; use public_traits::errors::{
MentatError,
Result,
};
use query::{ use query::{
PreparedResult, PreparedResult,