pub fn poll_close(&mut self) -> Poll<(), ()> {
        let inner = self.inner.as_ref().unwrap();

        let mut state = State::load(&inner.state, Acquire);

        if state.is_closed() {
            return Ok(Async::Ready(()));
        }

        if state.is_tx_task_set() {
            let will_notify = inner
                .tx_task
                .with(|ptr| unsafe { (&*ptr).will_notify_current() });

            if !will_notify {
                state = State::unset_tx_task(&inner.state);

                if state.is_closed() {
                    return Ok(Async::Ready(()));
                } else {
                    unsafe { inner.drop_tx_task() };
                }
            }
        }

        if !state.is_tx_task_set() {
            // Attempt to set the task
            unsafe {
                inner.set_tx_task();
            }

            // Update the state
            state = State::set_tx_task(&inner.state);

            if state.is_closed() {
                return Ok(Async::Ready(()));
            }
        }

        Ok(Async::NotReady)
    }
/// Check if the associated [`Receiver`] handle has been dropped.
///
/// # Return values
///
/// If `Ok(Ready)` is returned then the associated `Receiver` has been
/// dropped, which means any work required for sending should be canceled.
///
/// If `Ok(NotReady)` is returned then the associated `Receiver` is still
/// alive and may be able to receive a message if sent. The current task is
/// registered to receive a notification if the `Receiver` handle goes away.
///
/// [`Receiver`]: struct.Receiver.html
Check if the associated [`Receiver`] handle has been dropped.
Check if the associated [ ` Receiver ` ] handle has been dropped .
pub fn poll_close(&mut self) -> Poll<(), ()> {
        let inner = self.inner.as_ref().unwrap();
        let mut state = State::load(&inner.state, Acquire);
        if state.is_closed() {
            return Ok(Async::Ready(()));
        }
        if state.is_tx_task_set() {
            let will_notify = inner
                .tx_task
                .with(|ptr| unsafe { (&*ptr).will_notify_current() });
            if !will_notify {
                state = State::unset_tx_task(&inner.state);
                if state.is_closed() {
                    return Ok(Async::Ready(()));
                } else {
                    unsafe { inner.drop_tx_task() };
                }
            }
        }
        if !state.is_tx_task_set() {
            // Attempt to set the task
            unsafe {
                inner.set_tx_task();
            }
            // Update the state
            state = State::set_tx_task(&inner.state);
            if state.is_closed() {
                return Ok(Async::Ready(()));
            }
        }
        Ok(Async::NotReady)
    }
pub fn poll_close ( & mut self ) -> Poll < ( ) , ( ) > { let inner = self . inner . as_ref ( ) . unwrap ( ) ; let mut state = State :: load ( & inner . state , Acquire ) ; if state . is_closed ( ) { return Ok ( Async :: Ready ( ( ) ) ) ; } if state . is_tx_task_set ( ) { let will_notify = inner . tx_task . with ( | ptr | unsafe { ( & * ptr ) . will_notify_current ( ) } ) ; if ! will_notify { state = State :: unset_tx_task ( & inner . state ) ; if state . is_closed ( ) { return Ok ( Async :: Ready ( ( ) ) ) ; } else { unsafe { inner . drop_tx_task ( ) } ; } } } if ! state . is_tx_task_set ( ) { // Attempt to set the task unsafe { inner . set_tx_task ( ) ; } // Update the state state = State :: set_tx_task ( & inner . state ) ; if state . is_closed ( ) { return Ok ( Async :: Ready ( ( ) ) ) ; } } Ok ( Async :: NotReady ) }
Check if the associated [`Receiver`] handle has been dropped.
Check if the associated [ ` Receiver ` ] handle has been dropped .
&mut self
return values
If `Ok(Ready)` is returned then the associated `Receiver` has been
dropped, which means any work required for sending should be canceled.

If `Ok(NotReady)` is returned then the associated `Receiver` is still
alive and may be able to receive a message if sent. The current task is
registered to receive a notification if the `Receiver` handle goes away.

[`Receiver`]: struct.Receiver.html
If ` Ok ( Ready ) ` is returned then the associated ` Receiver ` has been dropped which means any work required for sending should be canceled . If ` Ok ( NotReady ) ` is returned then the associated ` Receiver ` is still alive and may be able to receive a message if sent . The current task is registered to receive a notification if the ` Receiver ` handle goes away . [ ` Receiver ` ] : struct . Receiver . html