Skip to content

Commit

Permalink
Merge v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
umut-sahin authored Aug 16, 2019
2 parents 65efad6 + ab3cb3a commit a4b5f19
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.0.1 / 16-08-2019
==================

- Various typos in READMEs are fixed. ([#2](https://github.com/umut-sahin/rust-examples/issues/2))
- Further details are added to the [read-from-console] examples README. ([#3](https://github.com/umut-sahin/rust-examples/issues/3))

1.0.0 / 15-07-2019
==================

Expand Down
4 changes: 2 additions & 2 deletions brainfuck-interpreter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The parser is a handwritten one.
It's pretty easy to read though.
If the parsing fails for some reason, a [**Result**]<**Interpreter**, **SyntaxError**> is returned with [**Err**] variant which contains the information about the error.

Otherwise, the parsing is successful and hence we got a nice **Interpreter** which contains a valid instruction list.
Otherwise, the parsing is successful and hence we got a nice **Interpreter**, which contains a valid instruction list.

At this point, all we need to do left is to interpret the instructions.
This functionality is implemented for **Interpreter** in a method named **execute**.
Expand All @@ -36,7 +36,7 @@ If **execute** fails to interpret the whole program, it returns a **RuntimeError
Finally, we call the **execute** method on the **Interpreter** we have.
If **execute** returns an [**Err**], we simply print the information about the error and exit the program with an erroneous return code.

Otherwise, everything went as expected so we terminate the program normally.
Otherwise, everything went as expected, so we terminate the program normally.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion command-line-arguments/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h1>command-line-arguments</h1>
A simple program which demonstrates how to iterate over the arguments which are passed during the program invocation
A simple program, which demonstrates how to iterate over the arguments, which are passed during the program invocation
</div>

## Authors
Expand Down
2 changes: 1 addition & 1 deletion memory-mapped-io/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In this example, we will only focus on [Memory Mapped File I/O].
[memmap] provides two structs, namely [**Mmap**] and [**MmapMut**].
The difference between them is pretty obvious.
For this example, we need to change the contents of the file **memory-mapped-io/assets/hello-world.txt**.
Thus we have used [**MmapMut**].
Thus, we have used [**MmapMut**].

To create the [**MmapMut**] instance, we have used the [**map_mut**] function associated with the [**MmapMut**] struct ([**map_mut**] is unsafe because [Memory Mapped I/O] itself is unsafe).
This method has one parameter, which is a reference to a [**std::fs::File**] instance.
Expand Down
2 changes: 1 addition & 1 deletion operator-overloading/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ None

## Notes

- Destruction's desugared form is not exactly as written above because the drop in there is actually [**std::mem::drop**] function, which takes it's argument by moving.
- Destruction's desugared form is not exactly as written above because the drop in there is actually [**std::mem::drop**] function, which takes its argument by moving.
So at the end of the [**std::mem::drop**] function, [**drop**] method of the [**std::ops::Drop**] trait will be called like the desugared form automatically.
- Descriptions of the [**std::cmp**] and [**std::ops**] modules explain further details perfectly.
So reading them is highly recommended.
Expand Down
8 changes: 6 additions & 2 deletions read-from-console/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h1>read-from-console</h1>
A simple program which demonstrates how to read from the standard input
A simple program, which demonstrates how to read from the standard input
</div>

## Authors
Expand All @@ -24,7 +24,7 @@ The program then waits for the user input.
This can be done with the [**read_line**] method on the [**Stdin**] struct ([**Stdin**] instance for the current process can be obtained with the [**stdin**] function in the standard [**io**] module).
The [**read_line**] method reads data to a [**String**] instance from the standard input until a newline character is encountered.

[**Strings**] automatically grow the on the heap, so we don't need to worry about the memory issues.
[**String**]s automatically grow the on the heap, so we don't need to worry about the memory issues.

However, we might run into other issues such as the input not being a valid UTF-8, or we might encounter a critical I/O error.
In our example, the [**unwrap**] method is used to handle those errors.
Expand Down Expand Up @@ -98,6 +98,8 @@ None
## Notes

- Newline character is always **\n** in [Rust]s standard library.
- [**std::process::exit**] immediately terminates the process without any clean up.
Thus, the variable **input**, is manually dropped before calling [**std::process::exit**].

## Further reading

Expand All @@ -122,6 +124,8 @@ None
https://doc.rust-lang.org/std/io/struct.Stdin.html#method.read_line
[**Result**]:
https://doc.rust-lang.org/std/result/enum.Result.html
[**std::process::exit**]:
https://doc.rust-lang.org/std/process/fn.exit.html
[**stdin**]:
https://doc.rust-lang.org/std/io/fn.stdin.html
[**Stdin**]:
Expand Down
2 changes: 1 addition & 1 deletion threads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Anyway, the closure that we passed while calling the [**spawn**] function writes
Now the main thread can continue its execution.
The [**join**] function returns the result of the closure to the main thread, which is **data_to_pass + 42** in this case.

Then, we assert that the **threads_return** is indeed **data_to_pass + 42** and we are done.
Then, we assert that the **threads_return** is indeed **data_to_pass + 42**, and we are done.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion write-to-console/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h1>write-to-console</h1>
A simple program which demonstrates how to write to the standard output
A simple program, which demonstrates how to write to the standard output
</div>

## Authors
Expand Down

0 comments on commit a4b5f19

Please sign in to comment.