diff options
Diffstat (limited to 'rustlings/exercises/19_smart_pointers/box1.rs')
| -rw-r--r-- | rustlings/exercises/19_smart_pointers/box1.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rustlings/exercises/19_smart_pointers/box1.rs b/rustlings/exercises/19_smart_pointers/box1.rs index d70e1c3..ee379ca 100644 --- a/rustlings/exercises/19_smart_pointers/box1.rs +++ b/rustlings/exercises/19_smart_pointers/box1.rs @@ -12,18 +12,18 @@ // TODO: Use a `Box` in the enum definition to make the code compile. #[derive(PartialEq, Debug)] enum List { - Cons(i32, List), + Cons(i32, Box<List>), Nil, } // TODO: Create an empty cons list. fn create_empty_list() -> List { - todo!() + List::Nil } // TODO: Create a non-empty cons list. fn create_non_empty_list() -> List { - todo!() + List::Cons(1, Box::new(List::Nil)) } fn main() { |