diff options
| author | tajo48 <55502906+tajo48@users.noreply.github.com> | 2023-06-15 00:46:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-15 00:46:45 +0200 |
| commit | e1704a2f1bd2e1c92e0741d656228fe6ccf36a35 (patch) | |
| tree | 6bbd1dd1ea127dd652e0fe64093c10a78734fdf5 /exercises/smart_pointers/box1.rs | |
| parent | 1e02f194fdd1cb1ca99cf1d93d11455db8b1bce6 (diff) | |
| parent | 0282da6881c0708b5aaf6a01e731b88b61201f71 (diff) | |
Merge branch 'main' into main
Diffstat (limited to 'exercises/smart_pointers/box1.rs')
| -rw-r--r-- | exercises/smart_pointers/box1.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/exercises/smart_pointers/box1.rs b/exercises/smart_pointers/box1.rs index 66cf00f..513e7da 100644 --- a/exercises/smart_pointers/box1.rs +++ b/exercises/smart_pointers/box1.rs @@ -1,13 +1,15 @@ // box1.rs // -// At compile time, Rust needs to know how much space a type takes up. This becomes problematic -// for recursive types, where a value can have as part of itself another value of the same type. -// To get around the issue, we can use a `Box` - a smart pointer used to store data on the heap, -// which also allows us to wrap a recursive type. +// At compile time, Rust needs to know how much space a type takes up. This +// becomes problematic for recursive types, where a value can have as part of +// itself another value of the same type. To get around the issue, we can use a +// `Box` - a smart pointer used to store data on the heap, which also allows us +// to wrap a recursive type. // -// The recursive type we're implementing in this exercise is the `cons list` - a data structure -// frequently found in functional programming languages. Each item in a cons list contains two -// elements: the value of the current item and the next item. The last item is a value called `Nil`. +// The recursive type we're implementing in this exercise is the `cons list` - a +// data structure frequently found in functional programming languages. Each +// item in a cons list contains two elements: the value of the current item and +// the next item. The last item is a value called `Nil`. // // Step 1: use a `Box` in the enum definition to make the code compile // Step 2: create both empty and non-empty cons lists by replacing `todo!()` |
