From dd85dc01d7240d9938a1424f92b297990febc571 Mon Sep 17 00:00:00 2001 From: Ivan Ukhov Date: Mon, 1 Jun 2015 16:30:02 -0400 Subject: [PATCH] Make Value::read take an immutable statement --- src/statement.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/statement.rs b/src/statement.rs index e10e0e3..0a2d1f1 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -20,7 +20,7 @@ pub enum Binding<'l> { /// A value stored in a prepared statement. pub trait Value { /// Read the value at a specific column. - fn read(statement: &mut Statement, i: usize) -> Result; + fn read(statement: &Statement, i: usize) -> Result; } impl<'l> Statement<'l> { @@ -51,7 +51,7 @@ impl<'l> Statement<'l> { /// Return the value of a column. #[inline] - pub fn column(&mut self, i: usize) -> Result { + pub fn column(&self, i: usize) -> Result { ::read(self, i) } @@ -77,19 +77,19 @@ impl<'l> Drop for Statement<'l> { } impl Value for f64 { - fn read(statement: &mut Statement, i: usize) -> Result { + fn read(statement: &Statement, i: usize) -> Result { Ok(unsafe { ::raw::sqlite3_column_double(statement.raw, i as c_int) as f64 }) } } impl Value for i64 { - fn read(statement: &mut Statement, i: usize) -> Result { + fn read(statement: &Statement, i: usize) -> Result { Ok(unsafe { ::raw::sqlite3_column_int64(statement.raw, i as c_int) as i64 }) } } impl Value for String { - fn read(statement: &mut Statement, i: usize) -> Result { + fn read(statement: &Statement, i: usize) -> Result { unsafe { let pointer = ::raw::sqlite3_column_text(statement.raw, i as c_int); if pointer.is_null() {