aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/src/record.rs
blob: b349853e0d63d613aeb2915671667b4d628800f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use super::*;

pub struct Record {
    values: Vec<Value>,
}

impl Record {
    pub fn values(&self) -> &[Value] {
        &self.values
    }
}

impl IntoIterator for Record {
    type Item = Value;
    type IntoIter = std::vec::IntoIter<Self::Item>;

    fn into_iter(self) -> Self::IntoIter {
        self.values.into_iter()
    }
}

impl From<Vec<Value>> for Record {
    fn from(values: Vec<Value>) -> Self {
        Record { values }
    }
}

impl From<Record> for Vec<Value> {
    fn from(record: Record) -> Self {
        record.values
    }
}

impl From<Row> for Record {
    fn from(row: Row) -> Self {
        Record { values: row.values }
    }
}