3. Given the following Rust code for a circular linked list with three nodes, what will be printed when traversing starting from head and printing data 4 times?
#[derive(Clone)]
struct Node {
data: i32,
next: Option<Box<Node>>,
}
fn main() {
let node3 = Node { data: 3, next: None };
let node2 = Node { data: 2, next: Some(Box::new(node3)) };
let mut node1 = Node { data: 1, next: Some(Box::new(node2)) };
// Making circular
let cloned_head = node1.clone();
node1.next.as_mut().unwrap().next.as_mut().unwrap().next = Some(Box::new(cloned_head));
let mut current = &node1;
for _ in 0..4 {
println!("{}", current.data);
current = current.next.as_ref().unwrap();
}
}