aboutsummaryrefslogtreecommitdiffstats
path: root/rustlings/exercises/19_smart_pointers/box1.rs
diff options
context:
space:
mode:
authorHunter Kvalevog <hunter@kvog.sh>2026-09-27 18:04:07 -0500
committerHunter Kvalevog <hunter@kvog.sh>2026-09-27 18:04:07 -0500
commita05710061b21f93f7bff294c611d0545dc1deaf6 (patch)
tree49b14da76ada52943ce4fd147c2aa3fe50d05d1a /rustlings/exercises/19_smart_pointers/box1.rs
parentcf7c9c5e9e878d74370cb90d7d38cee0b67201c5 (diff)
downloaddemos-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.rs6
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() {