Explain matching on &byte a bit more

This commit is contained in:
Carol (Nichols || Goulding) 2016-08-02 16:31:01 -04:00
parent 87154266d3
commit 32f087ef36

View File

@ -55,9 +55,10 @@ a tuple instead. The first element of the tuple is the index, and the
second element is a reference to the element itself. This is a bit second element is a reference to the element itself. This is a bit
nicer than calculating the index ourselves. nicer than calculating the index ourselves.
Since its a tuple, we can use patterns, just like elsewhere in Rust. Since its a tuple, we can use patterns, just like elsewhere in Rust. So we
So we match against the tuple with i for the index and &byte for match against the tuple with i for the index and &byte for the byte itself.
the byte itself. Since we get a reference to a byte, we can put the `&` in the pattern, and then
the binding `byte` will hold the actual byte, not a reference to a byte.
```rust,ignore ```rust,ignore
if byte == 32 { if byte == 32 {