diff options
| author | mo8it <mo8it@proton.me> | 2024-06-21 14:52:11 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-06-21 14:52:11 +0200 |
| commit | 835ec7262247a341295c1d6f3772901a5fad5148 (patch) | |
| tree | e8d19e0c5c64cf724c807903e1bfdd6f6d782f39 /rustlings-macros | |
| parent | a9f0c7bf1f00ab19733953d3121d462eede34466 (diff) | |
vecs2 solution + significant change to have a better comparison between both methods
Diffstat (limited to 'rustlings-macros')
| -rw-r--r-- | rustlings-macros/info.toml | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/rustlings-macros/info.toml b/rustlings-macros/info.toml index 21a27dd..3edd1c6 100644 --- a/rustlings-macros/info.toml +++ b/rustlings-macros/info.toml @@ -319,15 +319,10 @@ of the Rust book to learn more. name = "vecs2" dir = "05_vecs" hint = """ -In the first function we are looping over the Vector and getting a reference to -one `element` at a time. +In the first function, we create an empty vector and want to push new elements +to it. -To modify the value of that `element` we need to use the `*` dereference -operator. You can learn more in this chapter of the Rust book: -https://doc.rust-lang.org/stable/book/ch08-01-vectors.html#iterating-over-the-values-in-a-vector - -In the second function this dereferencing is not necessary, because the `map` -function expects the new value to be returned. +In the second function, we map the values of the input and collect them into a vector. After you've completed both functions, decide for yourself which approach you like better. |
