diff options
| author | Hunter Kvalevog <hunter@kvog.sh> | 2026-09-27 18:04:07 -0500 |
|---|---|---|
| committer | Hunter Kvalevog <hunter@kvog.sh> | 2026-09-27 18:04:07 -0500 |
| commit | 472f99c8011b8de3f796c1ddc5d8f50164a34940 (patch) | |
| tree | 49b14da76ada52943ce4fd147c2aa3fe50d05d1a /rustlings/exercises/19_smart_pointers/box1.rs | |
| parent | 67fb6c0eb507965836201551f90c7d637bf6cee0 (diff) | |
rustlings: complete 19
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() { |