mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 09:09:19 +08:00
Rustfmt
This commit is contained in:
parent
9fefa372db
commit
3a52dd65f0
@ -159,9 +159,8 @@ impl<'conn> io::Read for Blob<'conn> {
|
|||||||
if n <= 0 {
|
if n <= 0 {
|
||||||
return Ok(0);
|
return Ok(0);
|
||||||
}
|
}
|
||||||
let rc = unsafe {
|
let rc =
|
||||||
ffi::sqlite3_blob_read(self.blob, mem::transmute(buf.as_ptr()), n, self.pos)
|
unsafe { ffi::sqlite3_blob_read(self.blob, mem::transmute(buf.as_ptr()), n, self.pos) };
|
||||||
};
|
|
||||||
self.conn
|
self.conn
|
||||||
.decode_result(rc)
|
.decode_result(rc)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
|
@ -333,7 +333,9 @@ impl<'a> Context<'a> {
|
|||||||
///
|
///
|
||||||
/// `A` is the type of the aggregation context and `T` is the type of the final result.
|
/// `A` is the type of the aggregation context and `T` is the type of the final result.
|
||||||
/// Implementations should be stateless.
|
/// Implementations should be stateless.
|
||||||
pub trait Aggregate<A, T> where T: ToResult {
|
pub trait Aggregate<A, T>
|
||||||
|
where T: ToResult
|
||||||
|
{
|
||||||
/// Initializes the aggregation context. Will be called prior to the first call
|
/// Initializes the aggregation context. Will be called prior to the first call
|
||||||
/// to `step()` to set up the context for an invocation of the function. (Note:
|
/// to `step()` to set up the context for an invocation of the function. (Note:
|
||||||
/// `init()` will not be called if the there are no rows.)
|
/// `init()` will not be called if the there are no rows.)
|
||||||
|
@ -949,7 +949,8 @@ pub struct MappedRows<'stmt, F> {
|
|||||||
map: F,
|
map: F,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'stmt, T, F> Iterator for MappedRows<'stmt, F> where F: FnMut(&Row) -> T
|
impl<'stmt, T, F> Iterator for MappedRows<'stmt, F>
|
||||||
|
where F: FnMut(&Row) -> T
|
||||||
{
|
{
|
||||||
type Item = Result<T>;
|
type Item = Result<T>;
|
||||||
|
|
||||||
|
@ -190,9 +190,8 @@ mod test {
|
|||||||
let mut stmt = db.prepare("INSERT INTO test (x, y) VALUES (:x, :y)").unwrap();
|
let mut stmt = db.prepare("INSERT INTO test (x, y) VALUES (:x, :y)").unwrap();
|
||||||
stmt.execute_named(&[(":x", &"one")]).unwrap();
|
stmt.execute_named(&[(":x", &"one")]).unwrap();
|
||||||
|
|
||||||
let result: Option<String> = db.query_row("SELECT y FROM test WHERE x = 'one'",
|
let result: Option<String> =
|
||||||
&[],
|
db.query_row("SELECT y FROM test WHERE x = 'one'", &[], |row| row.get(0))
|
||||||
|row| row.get(0))
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(result.is_none());
|
assert!(result.is_none());
|
||||||
}
|
}
|
||||||
@ -207,9 +206,8 @@ mod test {
|
|||||||
stmt.execute_named(&[(":x", &"one")]).unwrap();
|
stmt.execute_named(&[(":x", &"one")]).unwrap();
|
||||||
stmt.execute_named(&[(":y", &"two")]).unwrap();
|
stmt.execute_named(&[(":y", &"two")]).unwrap();
|
||||||
|
|
||||||
let result: String = db.query_row("SELECT x FROM test WHERE y = 'two'",
|
let result: String =
|
||||||
&[],
|
db.query_row("SELECT x FROM test WHERE y = 'two'", &[], |row| row.get(0))
|
||||||
|row| row.get(0))
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(result, "one");
|
assert_eq!(result, "one");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user