From 6b033e8053a5bac70cac79e6be2644ea14f6ec2f Mon Sep 17 00:00:00 2001 From: Abdulla Abdurakhmanov Date: Mon, 6 Feb 2023 18:57:08 +0100 Subject: [PATCH] Change clone to ref for listen_changes --- src/db/listen_changes.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db/listen_changes.rs b/src/db/listen_changes.rs index de0a9ff..90552f7 100644 --- a/src/db/listen_changes.rs +++ b/src/db/listen_changes.rs @@ -227,7 +227,7 @@ where pub async fn start(&mut self, cb: FN) -> FirestoreResult<()> where - FN: Fn(FirestoreListenEvent, D) -> F + Send + Sync + 'static, + FN: Fn(FirestoreListenEvent, &D) -> F + Send + Sync + 'static, F: Future> + Send + 'static, { info!( @@ -296,7 +296,7 @@ where cb: FN, ) where D: FirestoreListenSupport + Clone + Send + Sync, - FN: Fn(FirestoreListenEvent, D) -> F + Send + Sync, + FN: Fn(FirestoreListenEvent, &D) -> F + Send + Sync, F: Future> + Send, { while !shutdown_flag.load(Ordering::Relaxed) { @@ -342,7 +342,7 @@ where } Some(response_type) => { - if let Err(err) = cb(response_type, db.clone()).await { + if let Err(err) = cb(response_type, &db).await { error!("Listener callback function error occurred {:?}.", err); break; }