1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-31 09:42:11 +02:00

25 Commits

Author SHA1 Message Date
Martin Geisler
aba7fd7f56
Simplify error handling pages ()
This makes the `use` statements more consistent and shortens some
variable names.
2023-06-22 16:27:06 +02:00
Andrew Walbran
c1ad97c659
Fix example to build and run () 2023-06-21 09:48:05 +01:00
Martin Geisler
6ade739651
Ensure code blocks are editable ()
We should default to making code blocks editable: this ensures
consistent syntax highlighting (see ) and it allows the instructor
to freely edit anything they want.
2023-04-27 23:45:41 +02:00
Martin Geisler
c0d03bd86b
Consistently use err for the error value () 2023-04-27 19:10:49 +02:00
Yuri Astrakhan
5cdb73387f
Inline format vars to make the format str simpler () 2023-04-06 12:00:10 +02:00
Andrew Walbran
7a22d5567a
Don't allocate in success case ()
`format!` was being called (and allocating a string) even in the success case.
2023-03-15 09:06:35 +01:00
Andrew Walbran
1be641203e
Split out example to separate page. ()
The example is quite long and so the page didn't easily fit on the
same screen as the explanation
2023-02-03 10:12:31 +00:00
Andrew Walbran
27b6165202 Implement Error. 2023-01-27 17:54:37 +00:00
Andrew Walbran
caaca140ca Another note for anyhow. 2023-01-27 17:54:37 +00:00
Andrew Walbran
79f5f0dade Add slide about Box<dyn Error> before introducing anyhow. 2023-01-27 17:54:37 +00:00
Andrew Walbran
e5c97e12cb No need for thiserror as well as anyhow. 2023-01-27 17:54:37 +00:00
Andrew Walbran
9fa0e89e90 It makes no sense to use both return and ?. 2023-01-27 17:54:37 +00:00
Andrew Walbran
52d28b155b Mention std::error::Error in speaker notes, and other useful traits. 2023-01-27 17:54:37 +00:00
Igor Petruk
617f4e2bb7
Update error-contexts.md ()
* Update error-contexts.md

Adding more speaker notes about `anyhow`.

* Add markup

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-01-24 07:33:03 +00:00
Igor Petruk
543cad59e4
Update result.md ()
* Update result.md

Adding a speaker note that `Result` documentation is a recommended read.

* Adding a note why `Result` encourages error checking.

* Wordsmithing

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 13:47:41 +00:00
Andy George
492037641e
fix Cargo.toml syntax () 2023-01-20 11:28:38 +01:00
Ilya Grigoriev
acdf00ae6e Add speaker notes about error examples 2023-01-11 18:14:58 -08:00
Ilya Grigoriev
68eed5b4f2
Error handling: clarify printing of Result
Two examples may print either `Ok(username)` or `Err(error)`.
This commit clarifies this fact.
2023-01-06 12:35:05 -08:00
Martin Geisler
9a68434cac
Merge pull request from ilyagr/patch-1
`anyhow`: Remove `ReadUsernameError::IoError`
2023-01-05 15:57:17 +01:00
Arman Yessenamanov
e1c670c4a8
Fix a typo in result.md
"have already see" -> "have already seen"
2023-01-05 14:41:40 +06:00
liao02x
8d36a3bdd3
fix typo in deriving-error-enums.md 2023-01-03 21:18:30 -08:00
Martin Geisler
c15e84f63e
More precise phrasing of what ? expands to
As per the suggestion from @QuineDot in .
2022-12-27 18:09:54 +01:00
Ilya Grigoriev
5ce7a08f0e
anyhow: say this example has fewer custom types 2022-12-23 13:35:40 -08:00
Ilya Grigoriev
894e694cdb
anyhow: Remove ReadUsernameError::IoError
As far as I understand, the example with the `anyhow` example
does not use its special `IoError` anymore, unlike the previous
example with just `thiserror`.

I think this should be made clear. I considered just adding a
`// Now unused` comment, but I think ti's clearer to just remove
the unused code.
2022-12-23 13:32:03 -08:00
Martin Geisler
c212a473ba Publish Comprehensive Rust 🦀 2022-12-21 16:38:28 +01:00