Pre: Move PushComputed up module hierarchy; make it public.

This commit is contained in:
Nick Alexander 2017-04-26 10:17:15 -07:00 committed by Richard Newman
parent 70c5bcfa99
commit 002c918c96
2 changed files with 17 additions and 14 deletions

View file

@ -841,6 +841,18 @@ impl ConjoiningClauses {
}
}
pub trait PushComputed {
fn push_computed(&mut self, item: ComputedTable) -> DatomsTable;
}
impl PushComputed for Vec<ComputedTable> {
fn push_computed(&mut self, item: ComputedTable) -> DatomsTable {
let next_index = self.len();
self.push(item);
DatomsTable::Computed(next_index)
}
}
// These are helpers that tests use to build Schema instances.
#[cfg(test)]
fn associate_ident(schema: &mut Schema, i: NamespacedKeyword, e: Entid) {

View file

@ -29,7 +29,10 @@ use mentat_query::{
WhereClause,
};
use clauses::ConjoiningClauses;
use clauses::{
ConjoiningClauses,
PushComputed,
};
use errors::{
Result,
@ -74,18 +77,6 @@ fn _simply_matches_value_place(left: &PatternValuePlace, right: &PatternValuePla
}
}
trait PushComputed {
fn push_computed(&mut self, item: ComputedTable) -> DatomsTable;
}
impl PushComputed for Vec<ComputedTable> {
fn push_computed(&mut self, item: ComputedTable) -> DatomsTable {
let next_index = self.len();
self.push(item);
DatomsTable::Computed(next_index)
}
}
pub enum DeconstructedOrJoin {
KnownSuccess,
KnownEmpty(EmptyBecause),
@ -1119,4 +1110,4 @@ mod testing {
[_ :foo/height ?x]]"#;
compare_ccs(alg(&schema, query), alg(&schema, simple));
}
}
}