diesel 0.4.1

A safe, extensible ORM and Query builder
Documentation
use db_result::DbResult;

pub trait Row {
    fn take(&mut self) -> Option<&[u8]>;
    fn next_is_null(&self, count: usize) -> bool;
}

pub struct DbRow<'a> {
    db_result: &'a DbResult,
    row_idx: usize,
    col_idx: usize,
}

impl<'a> DbRow<'a> {
    pub fn new(db_result: &'a DbResult, row_idx: usize) -> Self {
        DbRow {
            db_result: db_result,
            row_idx: row_idx,
            col_idx: 0,
        }
    }
}

impl<'a> Row for DbRow<'a> {
    fn take(&mut self) -> Option<&[u8]> {
        let current_idx = self.col_idx;
        self.col_idx += 1;
        self.db_result.get(self.row_idx, current_idx)
    }

    fn next_is_null(&self, count: usize) -> bool {
        (0..count).all(|i| {
            self.db_result.is_null(self.row_idx, self.col_idx + i)
        })
    }
}