Pre: move EmptyBecause into types.rs.

This commit is contained in:
Richard Newman 2017-03-27 19:34:02 -07:00
parent 8e6f37e709
commit 95a5326e23
2 changed files with 22 additions and 13 deletions

View file

@ -53,6 +53,7 @@ use types::{
ColumnConstraint, ColumnConstraint,
DatomsColumn, DatomsColumn,
DatomsTable, DatomsTable,
EmptyBecause,
NumericComparison, NumericComparison,
QualifiedAlias, QualifiedAlias,
QueryValue, QueryValue,
@ -160,19 +161,6 @@ pub struct ConjoiningClauses {
extracted_types: BTreeMap<Variable, QualifiedAlias>, extracted_types: BTreeMap<Variable, QualifiedAlias>,
} }
#[derive(PartialEq)]
pub enum EmptyBecause {
// Var, existing, desired.
TypeMismatch(Variable, HashSet<ValueType>, ValueType),
NonNumericArgument,
UnresolvedIdent(NamespacedKeyword),
InvalidAttributeIdent(NamespacedKeyword),
InvalidAttributeEntid(Entid),
InvalidBinding(DatomsColumn, TypedValue),
ValueTypeMismatch(ValueType, TypedValue),
AttributeLookupFailed, // Catch-all, because the table lookup code is lazy. TODO
}
impl Debug for EmptyBecause { impl Debug for EmptyBecause {
fn fmt(&self, f: &mut Formatter) -> ::std::fmt::Result { fn fmt(&self, f: &mut Formatter) -> ::std::fmt::Result {
use self::EmptyBecause::*; use self::EmptyBecause::*;

View file

@ -8,6 +8,8 @@
// CONDITIONS OF ANY KIND, either express or implied. See the License for the // CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License. // specific language governing permissions and limitations under the License.
use std::collections::HashSet;
use std::fmt::{ use std::fmt::{
Debug, Debug,
Formatter, Formatter,
@ -19,6 +21,12 @@ use mentat_core::{
TypedValue, TypedValue,
ValueType, ValueType,
}; };
use mentat_query::{
NamespacedKeyword,
Variable,
};
/// This enum models the fixed set of default tables we have -- two /// This enum models the fixed set of default tables we have -- two
/// tables and two views. /// tables and two views.
#[derive(PartialEq, Eq, Clone, Copy, Debug)] #[derive(PartialEq, Eq, Clone, Copy, Debug)]
@ -204,3 +212,16 @@ impl Debug for ColumnConstraint {
} }
} }
} }
#[derive(PartialEq)]
pub enum EmptyBecause {
// Var, existing, desired.
TypeMismatch(Variable, HashSet<ValueType>, ValueType),
NonNumericArgument,
UnresolvedIdent(NamespacedKeyword),
InvalidAttributeIdent(NamespacedKeyword),
InvalidAttributeEntid(Entid),
InvalidBinding(DatomsColumn, TypedValue),
ValueTypeMismatch(ValueType, TypedValue),
AttributeLookupFailed, // Catch-all, because the table lookup code is lazy. TODO
}