mirror of https://github.com/fafhrd91/actix-net
remove clone bound for stop closure
This commit is contained in:
parent
17a366ea5f
commit
935fcf384f
|
@ -325,12 +325,12 @@ impl ServerBuilder {
|
||||||
/// (If [ServerBuilder::system_exit] is set to true)
|
/// (If [ServerBuilder::system_exit] is set to true)
|
||||||
pub fn on_stop<F, Fut>(mut self, func: F) -> Self
|
pub fn on_stop<F, Fut>(mut self, func: F) -> Self
|
||||||
where
|
where
|
||||||
F: Fn() -> Fut + Clone + 'static,
|
F: Fn() -> Fut + 'static,
|
||||||
Fut: Future<Output = ()>,
|
Fut: Future<Output = ()> + 'static,
|
||||||
{
|
{
|
||||||
self.on_stop = Box::new(move || {
|
self.on_stop = Box::new(move || {
|
||||||
let func = func.clone();
|
let fut = func();
|
||||||
Box::pin(async move { func().await })
|
Box::pin(async move { fut.await })
|
||||||
});
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue