This commit is contained in:
gwenn 2016-05-03 21:00:59 +02:00
parent 59872a1850
commit 6fb549420b
4 changed files with 31 additions and 12 deletions

View File

@ -353,7 +353,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.)

View File

@ -950,7 +950,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>;

View File

@ -18,11 +18,19 @@ pub fn load_module(conn: &Connection) -> Result<()> {
conn.create_module("csv", &CSV_MODULE, aux) conn.create_module("csv", &CSV_MODULE, aux)
} }
init_module!(CSV_MODULE, CSVTab, CSVTabCursor, init_module!(CSV_MODULE,
csv_create, csv_best_index, csv_destroy, CSVTab,
csv_open, csv_close, CSVTabCursor,
csv_filter, csv_next, csv_eof, csv_create,
csv_column, csv_rowid); csv_best_index,
csv_destroy,
csv_open,
csv_close,
csv_filter,
csv_next,
csv_eof,
csv_column,
csv_rowid);
#[repr(C)] #[repr(C)]
struct CSVTab { struct CSVTab {

View File

@ -29,11 +29,19 @@ pub fn drop_int_array(conn: &Connection, name: &str) -> Result<()> {
conn.execute_batch(&format!("DROP TABLE temp.\"{0}\"", escape_double_quote(name))) conn.execute_batch(&format!("DROP TABLE temp.\"{0}\"", escape_double_quote(name)))
} }
init_module!(INT_ARRAY_MODULE, IntArrayVTab, IntArrayVTabCursor, init_module!(INT_ARRAY_MODULE,
int_array_create, int_array_best_index, int_array_destroy, IntArrayVTab,
int_array_open, int_array_close, IntArrayVTabCursor,
int_array_filter, int_array_next, int_array_eof, int_array_create,
int_array_column, int_array_rowid); int_array_best_index,
int_array_destroy,
int_array_open,
int_array_close,
int_array_filter,
int_array_next,
int_array_eof,
int_array_column,
int_array_rowid);
#[repr(C)] #[repr(C)]
struct IntArrayVTab { struct IntArrayVTab {