Skip to content

Commit 228afd7

Browse files
committed
Auto merge of #30807 - kolloch:patch-1, r=steveklabnik
When I read the book, the following sentence of the reference documentation helped me greatly to understand slices: "Slices are a view into a block of memory represented as a pointer and a length." In this commit, I tried to integrate the gist of that into the slice section inside of "primitive-types.md". I am not a native speaker, so feel very free to improve the wording. r? @steveklabnik
2 parents 8ff48fe + 235bdf1 commit 228afd7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/doc/book/primitive-types.md

+3
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ copying. For example, you might want to reference only one line of a file read
164164
into memory. By nature, a slice is not created directly, but from an existing
165165
variable binding. Slices have a defined length, can be mutable or immutable.
166166

167+
Internally, slices are represented as a pointer to the beginning of the data
168+
and a length.
169+
167170
## Slicing syntax
168171

169172
You can use a combo of `&` and `[]` to create a slice from various things. The

0 commit comments

Comments
 (0)