diff --git a/README.md b/README.md index 7a4d7f4..d3b178c 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ use sqlite::Value; let mut cursor = connection .prepare("SELECT * FROM users WHERE age > ?") .unwrap() - .cursor(); + .into_cursor(); cursor.bind(&[Value::Integer(50)]).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 662cc08..4bfa76f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,7 +88,7 @@ //! let mut cursor = connection //! .prepare("SELECT * FROM users WHERE age > ?") //! .unwrap() -//! .cursor(); +//! .into_cursor(); //! //! cursor.bind(&[Value::Integer(50)]).unwrap(); //! diff --git a/src/statement.rs b/src/statement.rs index 3379b4e..525d856 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -117,7 +117,7 @@ impl<'l> Statement<'l> { /// Upgrade to a cursor. #[inline] - pub fn cursor(self) -> Cursor<'l> { + pub fn into_cursor(self) -> Cursor<'l> { ::cursor::new(self) } diff --git a/tests/lib.rs b/tests/lib.rs index a39bac1..c84415c 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -117,7 +117,7 @@ fn cursor_read() { let statement = ok!(connection.prepare(statement)); let mut count = 0; - let mut cursor = statement.cursor(); + let mut cursor = statement.into_cursor(); while let Some(row) = ok!(cursor.next()) { let id = row[0].as_integer().unwrap(); if id == 1 { @@ -139,7 +139,7 @@ fn cursor_wildcard() { let statement = ok!(connection.prepare(statement)); let mut count = 0; - let mut cursor = statement.cursor(); + let mut cursor = statement.into_cursor(); while let Some(_) = ok!(cursor.next()) { count += 1; } @@ -154,7 +154,7 @@ fn cursor_wildcard_with_binding() { ok!(statement.bind(1, "%type")); let mut count = 0; - let mut cursor = statement.cursor(); + let mut cursor = statement.into_cursor(); while let Some(_) = ok!(cursor.next()) { count += 1; } @@ -166,10 +166,10 @@ fn cursor_workflow() { let connection = setup_users(":memory:"); let select = "SELECT id, name FROM users WHERE id = ?"; - let mut select = ok!(connection.prepare(select)).cursor(); + let mut select = ok!(connection.prepare(select)).into_cursor(); let insert = "INSERT INTO users (id, name) VALUES (?, ?)"; - let mut insert = ok!(connection.prepare(insert)).cursor(); + let mut insert = ok!(connection.prepare(insert)).into_cursor(); for _ in 0..10 { ok!(select.bind(&[Value::Integer(1)]));