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 | a05710061b21f93f7bff294c611d0545dc1deaf6 (patch) | |
| tree | 49b14da76ada52943ce4fd147c2aa3fe50d05d1a /rustlings/exercises/19_smart_pointers/box1.rs | |
| parent | cf7c9c5e9e878d74370cb90d7d38cee0b67201c5 (diff) | |
| download | demos-a05710061b21f93f7bff294c611d0545dc1deaf6.tar.gz demos-a05710061b21f93f7bff294c611d0545dc1deaf6.zip | |
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() { |
