the.bay.news

What's the difference bewteen while let Some(node) = curr and while let Some(node) = curr.as_mut()

The Rust Programming Language Forum
What's the difference bewteen while let Some(node) = curr and while let Some(node) = curr.as_mut()
Hi I try to write Single Linked List to practice Rust. But I just confused about following code. #[derive(Debug, PartialEq, Eq)] pub struct Node<T> { pub val: T, pub next: Option<Box<Node<T>>>, } #[derive(Debug, Default, PartialEq, Eq)] pub struct SinglyLinkedList<T> { pub head: Option<Box<Node<T>>>, } impl<T> SinglyLinkedList<T> { pub fn new() -> Self { SinglyLinkedList { head: None } } /// 1. insert in head pub fn push_front(&mut self, val: T) { ...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.