This is a suggestion for how we could make the protobuf exercise at the
end of day 3 better.
Generally speaking, the idea is to parse the protbuf bytes into data
types instead of only printing the parsing outcome to the console. To
make this a little more realistic, we also introduce a trait
`ProtoMessage` for message types.
I think this is more instructive than the current example. In
particular, we get to mess around with lifetimes. This might be a little
more complicated but can be a great opportunity for the students to tie
together different things they've learnt in the course so far.
What do you all think?
This modifies the exercise to lean more into interesting `match`
statements. It also uses the standard `Result` type, based on feedback
that students could understand it sufficiently at this point in the
course.
Addresses #1565.
`Ok(x?)` has the same outcome as `x` and save an unpacking/repacking
cycle.
`x as usize` has no effect when `x` already has type `usize`.
In `x < 4usize` the `usize` is unnecessary when `x` already has type
`usize`.
Currently, the implementation uses if-then-else chains and `<` and `>`.
This is not the most idiomatic Rust. Instead, we can use `cmp` and
`match` to make the code easier to read.
---------
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
This reverts #1490 due to errors seen in
https://github.com/google/comprehensive-rust/actions/runs/7188648811/job/19590765217.
The error says
Get:23 http://azure.archive.ubuntu.com/ubuntu jammy/main amd64
libc6-dev-arm64-cross all 2.35-0ubuntu1cross3 [1546 kB]
Fetched 41.7 MB in 1s (46.1 MB/s)
E: Failed to fetch
mirror+file:/etc/apt/apt-mirrors.txt/pool/main/b/binutils/binutils-aarch64-linux-gnu_2.38-4ubuntu2.3_amd64.deb
404 Not Found [IP: 52.147.219.192 80]
E: Unable to fetch some archives, maybe run apt-get update or try with
--fix-missing?
Error: Process completed with exit code 100.
This seems less transient than the error which made us remove the `apt
update` calls in #1490.
People are often confused by this: the fact that we can remove the `*`
in the `println!()` is not because the compiler auto-derefs here (it
does not), but because `Display` is implemented for `&T where T:
Display` (a blanket implementation).
Speaker notes for Chromium's third-party crate exercise list the
transitive dependencies that will be downloaded during the exercise.
Before this commit the list was missing the `redox_syscall` crate.
Additionally, the commit sorts the crates to make it easier to compare
with the output of `git status` or `ls`.
---------
Co-authored-by: Martin Geisler <martin@geisler.net>
I don't like shortening words, so I prefer "Documentation" over "Docs".
I find this less jargony and thus easier to read (and potentially also
easier to translate).
Hello, JA translation team!
(https://github.com/google/comprehensive-rust/issues/652)
As part of #1460, I normalized ja.po using mdbook-i18n-normalize 0.3.0.
Steps taken: `mdbook-i18n-normalize`.
I'm open to any feedback or suggestions. Thank you in advance!
This takes out the huge example with lots of macro magic. I don't think
we need it for an introductory course.
I also cleaned up the formatting a little and made sure to distinguish
between types and values.
---------
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
There must have been a merge conflict at some point which resulted in a
malformed table. The result was that most redirects were blindly ignored
by `mdbook`.
I noticed it for
https://google.github.io/comprehensive-rust/enums.html which stopped
working because of this.
I took out the memory management redirect since we already have a file
where redirect would be (`mdbook` helpfully emits an error in this
case).
If we use a type annotation, we get around explaining the turbo fish,
which isn't trivial without having introduced generics. Type
annotations on the other hand are known already.
Timing information is for a slide as a whole, so we use a sentence like
"This slide and its sub-slides should take about 15 minutes" in the
first chapter in the slide. Subsequent chapters in the same slide do not
need timing information.
Fixes#1552.
This incorporates the new Chromium material from #1479 as well as the
reshuffle and rewrite from #1073.
This is a clean update without any additional changes. I’ll un-fuzzy the
string later.
I swear I tested this in an actual Rust file, but I somehow messed up
when copy-pasting it into the example. The code is now in the test file
so it will be correct.
Why is the indentation wrong? Because of
https://github.com/rust-lang/mdBook/issues/1564
The indentation is not kept by the included content, which breaks the
Markdown.
With the latest version of mdbook-i18n-helpers, we now have support for
formatting in the `SUMMARY.md` file. This allows us to revert the
changes made in #130 when we first introduced the translation support.
This also aligns a few headings to match the heading in the outline.
While this isn’t strictly necessary, it removes a bit of work for the
translators.
As more and more Android teams start using Rust, the question of "How to do mocking?" has come up more frequently. Right now, we don't have a good answer to those teams, AOSP doesn't have any mocking framework available. That will change soon with the import of Mockall and this slide is part of the supporting documentation that we can point teams to.