mirror of
https://github.com/rust-lang/book.git
synced 2026-05-18 05:32:16 -04:00
Merge pull request #1999 from Zoybean/patch-4
Update Ch19.1 on slice splitting
This commit is contained in:
@@ -251,7 +251,7 @@ fn split_at_mut(slice: &mut [i32], mid: usize) -> (&mut [i32], &mut [i32]) {
|
||||
This function first gets the total length of the slice. Then it asserts that
|
||||
the index given as a parameter is within the slice by checking whether it’s
|
||||
less than or equal to the length. The assertion means that if we pass an index
|
||||
that is greater than the index to split the slice at, the function will panic
|
||||
that is greater than the length to split the slice at, the function will panic
|
||||
before it attempts to use that index.
|
||||
|
||||
Then we return two mutable slices in a tuple: one from the start of the
|
||||
|
||||
Reference in New Issue
Block a user