use std::ptr::NonNull; #[derive(Debug)] pub struct LinkedList { start: Option>>, end: Option>>, } impl Clone for LinkedList where T: Clone, { fn clone(&self) -> Self { todo!() } } pub struct Node { value: T, next: Option>>, prev: Option>>, } impl LinkedList { pub fn new() -> Self { Self { start: None, end: None, } } } impl IntoIterator for LinkedList { type Item = T; type IntoIter = IntoIter; fn into_iter(self) -> Self::IntoIter { todo!() } } pub struct IntoIter { item: Option>>, } impl IntoIter { fn new(list: LinkedList) -> Self { Self { item: list.start } } } impl Iterator for IntoIter { type Item = T; fn next(&mut self) -> Option { let next = self.item.take(); let ptr = match next { None => return None, Some(mut ptr) => unsafe { ptr.as_mut() }, }; todo!() } }