Skip to content

Commit bf94b12

Browse files
committed
Add review comments
1 parent 969e8e8 commit bf94b12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

08_traits_and_reading_bytes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Since vec[0..4] notation is not inclusive to the end of the index, we are skippi
2020

2121
Transactions are presented in hex format for a reason.
2222
They are designed to be serialized as byte streams that can be transmitted over the network and read one byte at a time in order.
23-
A better solution would be to automatically manage the indices and have a function with which we can just ask for the next bytes we require.
23+
A better solution would be to use a function that keeps track of the indices and allows us to request the number of bytes we require.
2424
Rust's standard library's [`Read`](https://doc.rust-lang.org/std/io/trait.Read.html) trait allows for exactly this.
2525
The slice data type in Rust implements the `Read` trait.
2626
What does this mean? It gives us a method, `read`, which will read some bytes from the slice and return that data in an array.
2727
When we call `read` again, it will start from where it left off.
28-
In other words, the `read` trait includes the machinery to keep track of the current position we are reading in the stream and to manage the pointer as it proceed.
28+
In other words, the `read` trait includes the machinery to keep track of the current position we are reading in the stream and to manage the pointer as it proceeds.
2929
This means we don't need to keep track of any indexes ourselves.
3030

3131
Let's walk through how this works at a high level with a quick example and then dive deeper into what traits are and how they work.

0 commit comments

Comments
 (0)