Skip to content

Commit cf9629c

Browse files
committed
feat: move box/arc behind iterators
1 parent 016d718 commit cf9629c

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

exercises/standard_library_types/arc1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Make this code compile by filling in a value for `shared_numbers` where the
1717
// first TODO comment is, and create an initial binding for `child_numbers`
1818
// where the second TODO comment is. Try not to create any copies of the `numbers` Vec!
19-
// Execute `rustlings hint arc1` for hints :)
19+
// Execute `rustlings hint arc1` or use the `hint` watch subcommand for a hint.
2020

2121
// I AM NOT DONE
2222

exercises/standard_library_types/box1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//
1515
// Note: the tests should not be changed
1616
//
17-
// Execute `rustlings hint box1` for hints :)
17+
// Execute `rustlings hint box1` or use the `hint` watch subcommand for a hint.
1818

1919
// I AM NOT DONE
2020

info.toml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -748,41 +748,6 @@ can negate the result of what you're doing using `!`, like `assert!(!having_fun(
748748

749749
# STANDARD LIBRARY TYPES
750750

751-
[[exercises]]
752-
name = "box1"
753-
path = "exercises/standard_library_types/box1.rs"
754-
mode = "test"
755-
hint = """
756-
Step 1
757-
The compiler's message should help: since we cannot store the value of the actual type
758-
when working with recursive types, we need to store a reference (pointer) to its value.
759-
We should, therefore, place our `List` inside a `Box`. More details in the book here:
760-
https://doc.rust-lang.org/book/ch15-01-box.html#enabling-recursive-types-with-boxes
761-
762-
Step 2
763-
Creating an empty list should be fairly straightforward (hint: peek at the assertions).
764-
For a non-empty list keep in mind that we want to use our Cons "list builder".
765-
Although the current list is one of integers (i32), feel free to change the definition
766-
and try other types!
767-
"""
768-
769-
[[exercises]]
770-
name = "arc1"
771-
path = "exercises/standard_library_types/arc1.rs"
772-
mode = "compile"
773-
hint = """
774-
Make `shared_numbers` be an `Arc` from the numbers vector. Then, in order
775-
to avoid creating a copy of `numbers`, you'll need to create `child_numbers`
776-
inside the loop but still in the main thread.
777-
778-
`child_numbers` should be a clone of the Arc of the numbers instead of a
779-
thread-local copy of the numbers.
780-
781-
This is a simple exercise if you understand the underlying concepts, but if this
782-
is too much of a struggle, consider reading through all of Chapter 16 in the book:
783-
https://doc.rust-lang.org/stable/book/ch16-00-concurrency.html
784-
"""
785-
786751
[[exercises]]
787752
name = "iterators1"
788753
path = "exercises/standard_library_types/iterators1.rs"
@@ -868,6 +833,41 @@ The fold method can be useful in the count_collection_iterator function.
868833
For a further challenge, consult the documentation for Iterator to find
869834
a different method that could make your code more compact than using fold."""
870835

836+
[[exercises]]
837+
name = "box1"
838+
path = "exercises/standard_library_types/box1.rs"
839+
mode = "test"
840+
hint = """
841+
Step 1
842+
The compiler's message should help: since we cannot store the value of the actual type
843+
when working with recursive types, we need to store a reference (pointer) to its value.
844+
We should, therefore, place our `List` inside a `Box`. More details in the book here:
845+
https://doc.rust-lang.org/book/ch15-01-box.html#enabling-recursive-types-with-boxes
846+
847+
Step 2
848+
Creating an empty list should be fairly straightforward (hint: peek at the assertions).
849+
For a non-empty list keep in mind that we want to use our Cons "list builder".
850+
Although the current list is one of integers (i32), feel free to change the definition
851+
and try other types!
852+
"""
853+
854+
[[exercises]]
855+
name = "arc1"
856+
path = "exercises/standard_library_types/arc1.rs"
857+
mode = "compile"
858+
hint = """
859+
Make `shared_numbers` be an `Arc` from the numbers vector. Then, in order
860+
to avoid creating a copy of `numbers`, you'll need to create `child_numbers`
861+
inside the loop but still in the main thread.
862+
863+
`child_numbers` should be a clone of the Arc of the numbers instead of a
864+
thread-local copy of the numbers.
865+
866+
This is a simple exercise if you understand the underlying concepts, but if this
867+
is too much of a struggle, consider reading through all of Chapter 16 in the book:
868+
https://doc.rust-lang.org/stable/book/ch16-00-concurrency.html
869+
"""
870+
871871
# THREADS
872872

873873
[[exercises]]

0 commit comments

Comments
 (0)