// iteration over a shared list starts with the last added
// element, LIFO-style
iteration over a shared list starts with the last added
element, LIFO-style
iteration over a shared list starts with the last added element LIFO - style
fn next(&mut self) -> Option<T> {
        let inner = std::mem::replace(&mut self.cursor, SharedList::<T>::nil());
        match inner.0.as_ref() {
            SharedListP::<T>::Nil => None,
            SharedListP::<T>::Cons(head, tail) => {
                self.cursor = SharedList(tail.0.clone());
                Some(head.clone())
            }
        }
    }
fn next ( & mut self ) -> Option < T > { let inner = std :: mem :: replace ( & mut self . cursor , SharedList :: < T > :: nil ( ) ) ; match inner . 0 . as_ref ( ) { SharedListP :: < T > :: Nil => None , SharedListP :: < T > :: Cons ( head , tail ) => { self . cursor = SharedList ( tail . 0 . clone ( ) ) ; Some ( head . clone ( ) ) } } }
iteration over a shared list starts with the last added
element, LIFO-style
iteration over a shared list starts with the last added element LIFO - style
&mut self