about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Kolloch <peter@mesosphere.com>2016-01-10 10:54:25 +0100
committerPeter Kolloch <peter@mesosphere.com>2016-01-10 10:54:25 +0100
commit235bdf1f3b463ae7bdb67196a8b28be434cde9d3 (patch)
tree3ef87994b4ee838126d7cc6ffc6102e6268e3b96
parentd70ab2bdf16c22b9f3ff0230089b44855e3f1593 (diff)
downloadrust-235bdf1f3b463ae7bdb67196a8b28be434cde9d3.tar.gz
rust-235bdf1f3b463ae7bdb67196a8b28be434cde9d3.zip
Book on slices: Mention internal representation
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".
-rw-r--r--src/doc/book/primitive-types.md3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/doc/book/primitive-types.md b/src/doc/book/primitive-types.md
index d6188fa7cdc..9378632987a 100644
--- a/src/doc/book/primitive-types.md
+++ b/src/doc/book/primitive-types.md
@@ -164,6 +164,9 @@ copying. For example, you might want to reference just one line of a file read
 into memory. By nature, a slice is not created directly, but from an existing
 variable binding. Slices have a defined length, can be mutable or immutable.
 
+Internally, slices are represented as a pointer to the beginning of the data 
+and a length.
+
 ## Slicing syntax
 
 You can use a combo of `&` and `[]` to create a slice from various things. The