You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/src/collections/vector.md
+7-5
Original file line number
Diff line number
Diff line change
@@ -111,9 +111,9 @@ fn main() {
111
111
112
112
113
113
### Slicing
114
-
A Vec can be mutable. On the other hand, slices are read-only objects. To get a slice, use`&`.
114
+
Immutable or mutableslices of Vecs can be taken, using`&` or `&mut, respectively.
115
115
116
-
In Rust, it’s more common to pass slices as arguments rather than vectors when you just want to provide read access. The same goes for `String` and `&str`.
116
+
In Rust, it’s more common to pass immutable slices as arguments rather than vectors when you just want to provide read access. The same goes for `String` and `&str`.
117
117
118
118
5. 🌟🌟
119
119
```rust,editable
@@ -129,14 +129,16 @@ fn main() {
129
129
130
130
assert_eq!(slice1, slice2);
131
131
132
-
// Slices are read only
132
+
// Slices can also be mutable, in which
133
+
// case mutating them will mutate the underlying Vec
0 commit comments