mentat/query-projector/src
Nick Alexander 2cb7d441dc Part 2: Make it easier to match tuple results.
Right now, we write code like
```rust
match q_once(q, inputs)?.into_tuple()? {
    Some(vs) => match (vs.len(), vs.get(0), vs.get(1)) {
        (2, &Some(Binding::Scalar(TypedValue::Long(a))), &Some(Binding::Scalar(TypedValue::Instant(ref b)))) => Some((a, b.clone())),
        _ => panic!(),
    },
    None => None,
}
```
to length-check tuples coming out of the database.  It can also lead
to a lot of cloning because references are the easiest thing to hand.

This commit allows to write code like
```rust
match q_once(q, inputs)?.into_tuple()? {
    Some((Binding::Scalar(TypedValue::Long(a)), Binding::Scalar(TypedValue::Instant(b)))) => Some((a, b)),
    Some(_) => panic!(),
    None => None,
}
```
which is generally much easier to reason about.
2018-07-05 16:45:42 -07:00
..
projectors Implement simple pull expressions (#638) r=nalexander 2018-05-04 12:56:00 -07:00
aggregates.rs Convert query_projector/ to failure. 2018-06-20 14:42:10 -07:00
binding_tuple.rs Part 2: Make it easier to match tuple results. 2018-07-05 16:45:42 -07:00
errors.rs Part 2: Make it easier to match tuple results. 2018-07-05 16:45:42 -07:00
lib.rs Part 2: Make it easier to match tuple results. 2018-07-05 16:45:42 -07:00
project.rs Convert query_projector/ to failure. 2018-06-20 14:42:10 -07:00
pull.rs Convert query_projector/ to failure. 2018-06-20 14:42:10 -07:00
relresult.rs Add 'Binding', a structured value type to return from queries. (#657) r=nalexander 2018-04-24 15:08:38 -07:00