pub fn cancel(&self) {
        let ptr = self.raw_task.as_ptr();
        let header = ptr as *mut Header;

        unsafe {
            let state = &mut (*header).state;

            // If the task has been completed or closed, it can't be cancelled.
            if *state & (COMPLETED | CLOSED) != 0 {
                return;
            }

            // If the task is not scheduled nor running, we'll need to schedule it.
            *state = if *state & (SCHEDULED | RUNNING) == 0 {
                (*state | SCHEDULED | CLOSED) + REFERENCE
            } else {
                *state | CLOSED
            };
            // If the task is not scheduled nor running, schedule it so that its future
            // gets dropped by the executor.
            if *state & (SCHEDULED | RUNNING) == 0 {
                ((*header).vtable.schedule)(ptr);
            }

            // Notify the awaiter that the task has been closed.
            if *state & AWAITER != 0 {
                (*header).notify();
            }
        }
    }
/// Cancels the task.
///
/// If the task has already completed, calling this method will have no effect.
///
/// When a task is cancelled, its future cannot be polled again and will be dropped instead.
Cancels the task.
If the task has already completed, calling this method will have no effect.

When a task is cancelled, its future cannot be polled again and will be dropped instead.
Cancels the task . If the task has already completed calling this method will have no effect . When a task is cancelled its future cannot be polled again and will be dropped instead .
pub fn cancel(&self) {
        let ptr = self.raw_task.as_ptr();
        let header = ptr as *mut Header;
        unsafe {
            let state = &mut (*header).state;
            // If the task has been completed or closed, it can't be cancelled.
            if *state & (COMPLETED | CLOSED) != 0 {
                return;
            }
            // If the task is not scheduled nor running, we'll need to schedule it.
            *state = if *state & (SCHEDULED | RUNNING) == 0 {
                (*state | SCHEDULED | CLOSED) + REFERENCE
            } else {
                *state | CLOSED
            };
            // If the task is not scheduled nor running, schedule it so that its future
            // gets dropped by the executor.
            if *state & (SCHEDULED | RUNNING) == 0 {
                ((*header).vtable.schedule)(ptr);
            }
            // Notify the awaiter that the task has been closed.
            if *state & AWAITER != 0 {
                (*header).notify();
            }
        }
    }
pub fn cancel ( & self ) { let ptr = self . raw_task . as_ptr ( ) ; let header = ptr as * mut Header ; unsafe { let state = & mut ( * header ) . state ; // If the task has been completed or closed, it can't be cancelled. if * state & ( COMPLETED | CLOSED ) != 0 { return ; } // If the task is not scheduled nor running, we'll need to schedule it. * state = if * state & ( SCHEDULED | RUNNING ) == 0 { ( * state | SCHEDULED | CLOSED ) + REFERENCE } else { * state | CLOSED } ; // If the task is not scheduled nor running, schedule it so that its future // gets dropped by the executor. if * state & ( SCHEDULED | RUNNING ) == 0 { ( ( * header ) . vtable . schedule ) ( ptr ) ; } // Notify the awaiter that the task has been closed. if * state & AWAITER != 0 { ( * header ) . notify ( ) ; } } }
Cancels the task.
Cancels the task .
&self
&self