From 0120c3a97916a5a18ba6d3412f18d6763ea55362 Mon Sep 17 00:00:00 2001 From: mckzm <134839822+mckzm@users.noreply.github.com> Date: Sat, 15 Jun 2024 13:44:11 +0900 Subject: [PATCH] Further clarification on the benefits of passing in immutable slices to functions --- en/src/collections/vector.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/src/collections/vector.md b/en/src/collections/vector.md index bf21c7a..6b19134 100644 --- a/en/src/collections/vector.md +++ b/en/src/collections/vector.md @@ -113,7 +113,7 @@ fn main() { ### Slicing Immutable or mutable slices of Vecs can be taken, using `&` or `&mut, respectively. -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`. +In Rust, itโ€™s more common to pass immutable slices as arguments rather than vectors when you just want to provide read access, as this is more flexible (no move) and efficient (no copy). The same goes for `String` and `&str`. 5. ๐ŸŒŸ๐ŸŒŸ ```rust,editable