pub(crate) unsafe fn remove(&mut self, node: NonNull<T::Target>) -> Option<T::Handle> {
        if let Some(prev) = T::pointers(node).as_ref().prev {
            debug_assert_eq!(T::pointers(prev).as_ref().next, Some(node));
            T::pointers(prev).as_mut().next = T::pointers(node).as_ref().next;
        } else {
            if self.head != Some(node) {
                return None;
            }

            self.head = T::pointers(node).as_ref().next;
        }

        if let Some(next) = T::pointers(node).as_ref().next {
            debug_assert_eq!(T::pointers(next).as_ref().prev, Some(node));
            T::pointers(next).as_mut().prev = T::pointers(node).as_ref().prev;
        } else {
            // This might be the last item in the list
            if self.tail != Some(node) {
                return None;
            }

            self.tail = T::pointers(node).as_ref().prev;
        }

        T::pointers(node).as_mut().next = None;
        T::pointers(node).as_mut().prev = None;

        Some(T::from_raw(node))
    }
/// Removes the specified node from the list
///
/// # Safety
///
/// The caller **must** ensure that `node` is currently contained by
/// `self` or not contained by any other list.
Removes the specified node from the list
Removes the specified node from the list
pub(crate) unsafe fn remove(&mut self, node: NonNull<T::Target>) -> Option<T::Handle> {
        if let Some(prev) = T::pointers(node).as_ref().prev {
            debug_assert_eq!(T::pointers(prev).as_ref().next, Some(node));
            T::pointers(prev).as_mut().next = T::pointers(node).as_ref().next;
        } else {
            if self.head != Some(node) {
                return None;
            }
            self.head = T::pointers(node).as_ref().next;
        }
        if let Some(next) = T::pointers(node).as_ref().next {
            debug_assert_eq!(T::pointers(next).as_ref().prev, Some(node));
            T::pointers(next).as_mut().prev = T::pointers(node).as_ref().prev;
        } else {
            // This might be the last item in the list
            if self.tail != Some(node) {
                return None;
            }
            self.tail = T::pointers(node).as_ref().prev;
        }
        T::pointers(node).as_mut().next = None;
        T::pointers(node).as_mut().prev = None;
        Some(T::from_raw(node))
    }
pub ( crate ) unsafe fn remove ( & mut self , node : NonNull < T :: Target > ) -> Option < T :: Handle > { if let Some ( prev ) = T :: pointers ( node ) . as_ref ( ) . prev { debug_assert_eq ! ( T pointers ( prev ) as_ref ( ) next Some ( node ) ) ; T :: pointers ( prev ) . as_mut ( ) . next = T :: pointers ( node ) . as_ref ( ) . next ; } else { if self . head != Some ( node ) { return None ; } self . head = T :: pointers ( node ) . as_ref ( ) . next ; } if let Some ( next ) = T :: pointers ( node ) . as_ref ( ) . next { debug_assert_eq ! ( T pointers ( next ) as_ref ( ) prev Some ( node ) ) ; T :: pointers ( next ) . as_mut ( ) . prev = T :: pointers ( node ) . as_ref ( ) . prev ; } else { // This might be the last item in the list if self . tail != Some ( node ) { return None ; } self . tail = T :: pointers ( node ) . as_ref ( ) . prev ; } T :: pointers ( node ) . as_mut ( ) . next = None ; T :: pointers ( node ) . as_mut ( ) . prev = None ; Some ( T :: from_raw ( node ) ) }
Removes the specified node from the list
Removes the specified node from the list
&mut self
node
NonNull<T::Target>
safety
The caller **must** ensure that `node` is currently contained by
`self` or not contained by any other list.
The caller ** must ** ensure that ` node ` is currently contained by ` self ` or not contained by any other list .