Open X01XX opened 1 year ago
In fourth.rs, my cargo, (edition = "2018"), wants Node prev and next Boxed. It was not too hard to make it work. How about printing? Something like:
impl<T: std::fmt::Display> fmt::Display for List<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut rc_str = String::from("("); let mut cur_link = &self.head; let mut start = true; while let Some(boxed_node) = cur_link { if start { } else { rc_str.push_str(", "); } start = false; rc_str.push_str(&format!("{}", boxed_node.elem)); cur_link = &boxed_node.next; } rc_str.push_str(")"); write!(f, "{}", rc_str) } }
Improved code formatting.
In fourth.rs, my cargo, (edition = "2018"), wants Node prev and next Boxed. It was not too hard to make it work. How about printing? Something like: