pub(crate) fn cancel(&self, key: TaskKey) -> bool {
        if let Some(task) = self.registry.get(key) {
            let r = task.get_stop_reason();
            if r != StopReason::Cancelled {
                task.set_stop_reason(StopReason::Cancelled);
                if r == StopReason::Suspended {
                    self.dec_suspended();
                }
                return true;
            }
        }
        false
    }
//if rotate_once encounters cancelled task, then it will be removed from queue and registry
if rotate_once encounters cancelled task, then it will be removed from queue and registry
if rotate_once encounters cancelled task then it will be removed from queue and registry
pub(crate) fn cancel(&self, key: TaskKey) -> bool {
        if let Some(task) = self.registry.get(key) {
            let r = task.get_stop_reason();
            if r != StopReason::Cancelled {
                task.set_stop_reason(StopReason::Cancelled);
                if r == StopReason::Suspended {
                    self.dec_suspended();
                }
                return true;
            }
        }
        false
    }
pub ( crate ) fn cancel ( & self , key : TaskKey ) -> bool { if let Some ( task ) = self . registry . get ( key ) { let r = task . get_stop_reason ( ) ; if r != StopReason :: Cancelled { task . set_stop_reason ( StopReason :: Cancelled ) ; if r == StopReason :: Suspended { self . dec_suspended ( ) ; } return true ; } } false }
if rotate_once encounters cancelled task, then it will be removed from queue and registry
if rotate_once encounters cancelled task then it will be removed from queue and registry
&self
key
TaskKey
&self
key
TaskKey