From e4819b6adc994e46b73845adce4ac22a195feaf8 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Thu, 7 Jan 2016 11:42:39 -0500 Subject: [PATCH] Give Aggregate::finalize ownership of the context it created --- src/functions.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index d856ef6..eb54688 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -342,7 +342,7 @@ pub trait Aggregate where T: ToResult { /// "step" function called once for each row in an aggregate group. fn step(&self, &mut Context, &mut A) -> Result<()>; /// Computes and returns the final result. - fn finalize(&self, &A) -> Result; + fn finalize(&self, A) -> Result; } @@ -549,7 +549,7 @@ impl InnerConnection { let ac: *mut A = *pac; let a = Box::from_raw(mem::transmute(ac)); // to be freed - match (*boxed_aggr).finalize(&a) { + match (*boxed_aggr).finalize(*a) { Ok(r) => r.set_result(ctx), Err(Error::SqliteFailure(err, s)) => { ffi::sqlite3_result_error_code(ctx, err.extended_code); @@ -783,8 +783,8 @@ mod test { Ok(()) } - fn finalize(&self, sum: &i64) -> Result { - Ok(*sum) + fn finalize(&self, sum: i64) -> Result { + Ok(sum) } }