fn using_index<'c, 's: 'c>(&'s self,
                               conds: &'c [cmp::Condition<'c, T>])
                               -> Box<Iterator<Item = usize> + 's> {

        use EqualityIndex;
        let best_idx = conds.iter()
            .enumerate()
            .filter_map(|(ci, c)| self.indices.get(&c.column).and_then(|idx| Some((ci, idx))))
            .filter(|&(ci, _)| {
                // does this index work for the operation in question?
                match conds[ci].cmp {
                    cmp::Comparison::Equal(cmp::Value::Const(..)) => true,
                    _ => false,
                }
            })
            .min_by_key(|&(_, idx)| idx.estimate());

        best_idx.and_then(|(ci, idx)| match conds[ci].cmp {
                cmp::Comparison::Equal(cmp::Value::Const(ref v)) => Some(idx.lookup(v)),
                _ => unreachable!(),
            })
            .unwrap_or_else(|| Box::new(self.rows.keys().map(|k| *k)))
    }
/// Decide what index to use in order to match the given conditions most efficiently. Note that
/// the iterator returned by this method will return a superset of the rows that match the
/// given conditions. Users will need to match each individual row against `conds` again.
///
/// The lifetime bounds here deserve some explanation. Previously, this was simply `'a` for
/// everything, but this means that the items returned from the iterator were bound by the
/// lifetime of the conditions. This is clearly not necessary. It also meant that you couldn't
/// `.collect()` the results and continue referring to them after the conditions have gone out
/// of scope.
Decide what index to use in order to match the given conditions most efficiently. Note that
the iterator returned by this method will return a superset of the rows that match the
given conditions. Users will need to match each individual row against `conds` again.

The lifetime bounds here deserve some explanation. Previously, this was simply `'a` for
everything, but this means that the items returned from the iterator were bound by the
lifetime of the conditions. This is clearly not necessary. It also meant that you couldn't
`.collect()` the results and continue referring to them after the conditions have gone out
of scope.
Decide what index to use in order to match the given conditions most efficiently . Note that the iterator returned by this method will return a superset of the rows that match the given conditions . Users will need to match each individual row against ` conds ` again . The lifetime bounds here deserve some explanation . Previously this was simply ` ' a ` for everything but this means that the items returned from the iterator were bound by the lifetime of the conditions . This is clearly not necessary . It also meant that you couldn ' t ` . collect () ` the results and continue referring to them after the conditions have gone out of scope .
fn using_index<'c, 's: 'c>(&'s self,
                               conds: &'c [cmp::Condition<'c, T>])
                               -> Box<Iterator<Item = usize> + 's> {
        use EqualityIndex;
        let best_idx = conds.iter()
            .enumerate()
            .filter_map(|(ci, c)| self.indices.get(&c.column).and_then(|idx| Some((ci, idx))))
            .filter(|&(ci, _)| {
                // does this index work for the operation in question?
                match conds[ci].cmp {
                    cmp::Comparison::Equal(cmp::Value::Const(..)) => true,
                    _ => false,
                }
            })
            .min_by_key(|&(_, idx)| idx.estimate());
        best_idx.and_then(|(ci, idx)| match conds[ci].cmp {
                cmp::Comparison::Equal(cmp::Value::Const(ref v)) => Some(idx.lookup(v)),
                _ => unreachable!(),
            })
            .unwrap_or_else(|| Box::new(self.rows.keys().map(|k| *k)))
    }
fn using_index < ' c , ' s : ' c > ( & ' s self , conds : & ' c [ cmp :: Condition < ' c , T > ] ) -> Box < Iterator < Item = usize > + ' s > { use EqualityIndex ; let best_idx = conds . iter ( ) . enumerate ( ) . filter_map ( | ( ci , c ) | self . indices . get ( & c . column ) . and_then ( | idx | Some ( ( ci , idx ) ) ) ) . filter ( | & ( ci , _ ) | { // does this index work for the operation in question? match conds [ ci ] . cmp { cmp :: Comparison :: Equal ( cmp :: Value :: Const ( .. ) ) => true , _ => false , } } ) . min_by_key ( | & ( _ , idx ) | idx . estimate ( ) ) ; best_idx . and_then ( | ( ci , idx ) | match conds [ ci ] . cmp { cmp :: Comparison :: Equal ( cmp :: Value :: Const ( ref v ) ) => Some ( idx . lookup ( v ) ) , _ => unreachable ! ( ) , } ) . unwrap_or_else ( | | Box :: new ( self . rows . keys ( ) . map ( | k | * k ) ) ) }
Decide what index to use in order to match the given conditions most efficiently.
Decide what index to use in order to match the given conditions most efficiently .
&'s self
conds
&'c [cmp::Condition<'c, T>]
&'s self
conds
&'c [cmp::Condition<'c, T>]