On a nickel web service I would like to execute a function when a response send finishes. I've found the 'on_send' method on this doc, but I can't get it to build.
I get this error:
type mismatch: the type
[closure@src/models/plugins/session.rs:78:22: 78:31 x:_]implements the traitstd::ops::FnMut<()>, but the traitfor<'r> std::ops::FnMut<(&'r mut nickel::Response<'_, D>,)>is required (expected tuple, found ())
and this one
type mismatch: the type
[closure@src/models/plugins/session.rs:78:22: 78:31 x:_]implements the traitstd::ops::FnOnce<()>, but the traitfor<'r> std::ops::FnOnce<(&'r mut nickel::Response<'_, D>,)>is required (expected tuple, found ())
My code sample is
let mut x: usize = 1;
let update = || x += 2 ;
res.on_send(update);
Where res is &mut Response<'mw, D>