Solve box1.

This commit is contained in:
Leonardo Freua 2021-12-23 23:21:09 -03:00
parent 5e7eac6be6
commit 18ddc66f50

View File

@ -16,11 +16,9 @@
//
// Execute `rustlings hint box1` for hints :)
// I AM NOT DONE
#[derive(PartialEq, Debug)]
pub enum List {
Cons(i32, List),
Cons(i32, Box<List>),
Nil,
}
@ -33,11 +31,14 @@ fn main() {
}
pub fn create_empty_list() -> List {
unimplemented!()
List::Nil
}
pub fn create_non_empty_list() -> List {
unimplemented!()
List::Cons(
1,
Box::new(List::Cons(2, Box::new(List::Cons(3, Box::new(List::Nil))))),
)
}
#[cfg(test)]