//! Watch handle for async watch tasks.
usecrate::RaftTypeConfig;usecrate::type_config::alias::JoinHandleOf;usecrate::type_config::alias::OneshotSenderOf;/// Handle to control an async watch task.
////// Use [`close()`](`Self::close`) to stop watching and wait for the task to complete.
pubstructWatchChangeHandle<C>
where C: RaftTypeConfig
{pub(crate)cancel_tx:Option<OneshotSenderOf<C, ()>>,
pub(crate)join_handle:Option<JoinHandleOf<C, ()>>,
}impl<C>WatchChangeHandle<C>where C: RaftTypeConfig
{/// Stop watching and wait for the task to complete.
pub async fnclose(&mutself){// Drop the sender to signal shutdown
drop(self.cancel_tx.take());// Wait for task to finish
ifletSome(handle)=self.join_handle.take(){
handle.await.ok();}}}