mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 19:41:37 +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 {
|
||||
return Ok(0);
|
||||
}
|
||||
let rc = unsafe {
|
||||
ffi::sqlite3_blob_read(self.blob, mem::transmute(buf.as_ptr()), n, self.pos)
|
||||
};
|
||||
let rc =
|
||||
unsafe { ffi::sqlite3_blob_read(self.blob, mem::transmute(buf.as_ptr()), n, self.pos) };
|
||||
self.conn
|
||||
.decode_result(rc)
|
||||
.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.
|
||||
/// 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
|
||||
/// 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.)
|
||||
|
@ -949,7 +949,8 @@ pub struct MappedRows<'stmt, 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>;
|
||||
|
||||
|
@ -190,9 +190,8 @@ mod test {
|
||||
let mut stmt = db.prepare("INSERT INTO test (x, y) VALUES (:x, :y)").unwrap();
|
||||
stmt.execute_named(&[(":x", &"one")]).unwrap();
|
||||
|
||||
let result: Option<String> = db.query_row("SELECT y FROM test WHERE x = 'one'",
|
||||
&[],
|
||||
|row| row.get(0))
|
||||
let result: Option<String> =
|
||||
db.query_row("SELECT y FROM test WHERE x = 'one'", &[], |row| row.get(0))
|
||||
.unwrap();
|
||||
assert!(result.is_none());
|
||||
}
|
||||
@ -207,9 +206,8 @@ mod test {
|
||||
stmt.execute_named(&[(":x", &"one")]).unwrap();
|
||||
stmt.execute_named(&[(":y", &"two")]).unwrap();
|
||||
|
||||
let result: String = db.query_row("SELECT x FROM test WHERE y = 'two'",
|
||||
&[],
|
||||
|row| row.get(0))
|
||||
let result: String =
|
||||
db.query_row("SELECT x FROM test WHERE y = 'two'", &[], |row| row.get(0))
|
||||
.unwrap();
|
||||
assert_eq!(result, "one");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user