Finish Box

This commit is contained in:
Dylan Smith
2024-04-19 13:56:27 -04:00
parent c5b8b068ea
commit 44e3362386

View File

@@ -18,11 +18,9 @@
// //
// Execute `rustlings hint box1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint box1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug)]
pub enum List { pub enum List {
Cons(i32, List), Cons(i32, Box<List>),
Nil, Nil,
} }
@@ -35,11 +33,11 @@ fn main() {
} }
pub fn create_empty_list() -> List { pub fn create_empty_list() -> List {
todo!() List::Nil
} }
pub fn create_non_empty_list() -> List { pub fn create_non_empty_list() -> List {
todo!() List::Cons(3, Box::new(List::Nil))
} }
#[cfg(test)] #[cfg(test)]