1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-15 05:40:30 +02:00
Commit Graph

619 Commits

Author SHA1 Message Date
473fd02be7 Update sizes.md (#228)
Adding more details in how to control Rust enum size and discriminant values.
2023-01-23 11:33:23 +00:00
8dd749da60 Update field-shorthand.md (#227)
Introducing `Self` type that students can encounter in many places and nice to use. It is only mentioned later in the course, but it is not defined currently.
2023-01-23 11:32:46 +00:00
356d1cec19 Update boot-library.md (#225)
Adding a link to the Solution.
2023-01-23 11:30:52 +00:00
820453ba08 Update structs.md (#232)
Extending a struct example that demonstrates how to change values and how to partially copy structs.
2023-01-23 11:26:22 +00:00
4c052d33c8 Update borrowing.md (#222) 2023-01-23 11:24:17 +00:00
de4aa3de88 Update moves-function-calls.md (#220)
Additional note helps to understand what move really means. The `name` ownership went fully into the `say_hello`.
2023-01-23 11:23:44 +00:00
8c58253217 Update the Speaker Notes of the type-inference.md (#214)
* Update the Speaker Notes of the type-inference.md

I think this is one of the critical moments in understanding Rust. This behavior is different from many static and dynamic programming languages.

* Fix typo

Co-authored-by: Andrew Walbran <qwandor@google.com>
2023-01-23 11:05:46 +00:00
ec7125da2e Adding a link to Solutions from for-loops.md and extending the answer to the bonus questions. (#213)
* Update for-loops.md

* Update solutions-morning.md
2023-01-23 11:05:36 +00:00
4760295030 Update Speaker Notes for compound-types.md (#207)
It could be a "gotcha" moment for readers when they associate `()` with `void` from, say, C++.
2023-01-23 11:04:38 +00:00
dc894b1e9d Update arc.md (#255)
Adding more information about `Arc`: what it stands for, costs and that reference cycles can occur.
2023-01-23 10:57:10 +00:00
8107a0ea2b Update scoped-threads.md (#253)
Adding speaker notes explaining why scoped threads work and what borrowing rules apply.
2023-01-23 10:56:32 +00:00
77a60d4101 Update send-sync.md (#258)
Adding notes that these traits are not to be implemented directly. Yet they are still to be used as normal traits in generic constraints.
2023-01-23 08:51:41 +01:00
905d0a067e Update implicit-conversions.md (#210)
I suggest to clarify that you only need to implement `From` and nobody really implements `Into` as soon as `From` is implemented.

I decided to add a separate paragraph after the `i8` and `i16` example, as they provide intuitive understanding of reverse relationship between `From` and `Into`. Alternatively trying to explain `From` and `Into` in generic way sounds more confusing than just adding this sentence after the specific example.
2023-01-21 14:20:14 +00:00
25a32abef7 Update Speaker Notes for compile-time.md (#205)
* Update Speaker Notes for compile-time.md

The definition of memory leaks is indeed blurry, so it is important not have right expectations about this particular kind of error.

Co-authored-by: Martin Geisler <martin@geisler.net>
2023-01-21 15:13:51 +01:00
79decc5540 Update Speaker Notes for what-is-rust.md (#204) 2023-01-21 14:10:00 +00:00
d4c0099781 Added speaker notes to enum sizes (#201)
* Added speaker notes to enum sizes

* Update sizes.md

Just formatting

Co-authored-by: Fabian Bornhofen <fbornhofen@google.com>
2023-01-20 22:55:30 +01:00
dbc11b2df2 Watch po/ directory for changes (#188)
This makes `mdbook serve` automatically reload the page when
translations change.
2023-01-20 11:36:14 +01:00
492037641e fix Cargo.toml syntax (#190) 2023-01-20 11:28:38 +01:00
790e964ee6 Merge pull request #186 from rastringer/patch-1
Speaker notes for 6.5 Functions
2023-01-19 14:48:11 +01:00
2d4340f3eb Speaker notes for 6.5 Functions
Adds speaker notes covering functions basics (declaration parameters, return values, the 'unit' type.
2023-01-19 12:16:43 +00:00
eb9f873466 Merge pull request #185 from markozagar/zagar
Edits to Day1 Morning material
2023-01-19 11:55:12 +00:00
6bda89f34e Clarification on references 2023-01-19 10:51:35 +00:00
529d4bf20c Speaker note tweaks for compound types 2023-01-19 10:51:35 +00:00
7a2ffda266 Mention ADT and zero-cost abstractions among modern features 2023-01-19 10:51:35 +00:00
20601319f2 Merge pull request #130 from google/translations
Add support for translations
2023-01-18 16:37:07 +01:00
f42c76e6a8 Test that a no-op translation does nothing
This ensures that the full mdbook-xgettext and mdbook-gettext workflow
is stable and doesn’t include spurious newlines.
2023-01-18 16:12:53 +01:00
c45bb19528 Test i18n-helpers on pull requests
This ensures that our i18n helpers stay working.
2023-01-18 16:12:53 +01:00
afa63ad7b5 Test that translations on pull requests
This adds a simple validation step to the PRs: calling ‘msgfmt’ will
check that the ‘.po’ files are well-formed.
2023-01-18 16:12:53 +01:00
2de9c0dae8 Start a Danish translation 2023-01-18 16:12:53 +01:00
48ec773052 Add support for translations
This implements a translation pipeline using the industry-standard
Gettext[1] system.

I picked Gettext for the reasons described in [2] and [3]:

* It’s widely used in open source software. This means that there are
  graphical editors which will help you in editing the `.po` files. An
  example is Poedit[4], which is available for all major platforms.

  There are also many online systems for doing translations. An
  example is Pontoon[5], which is used for the Rust website itself. We
  can consider setting up such an instance ourselves.

* It is a light-weight yet structured format. This means that nothing
  changes with regards to how you update the original English text. We
  can still accept fixes and PRs like normal.

  The structure means that translators can see exactly which part of
  the course they need to update after a change. This is completely
  lost if you simply copy over the original text and translate it
  in-place in the Markdown files.

The code here only adds support for translations. They are not yet
tested, published or used for anything. Next steps will be:

* Add support for switching languages via a bit of JavaScript on each
  page.

* Update the speaker notes feature to support translations (right now
  “Speaker Notes” is hard-coded into the generated HTML). I think we
  should turn it into a mdbook preprocessor instead.

* Add testing: We should test that the `.po` files are well-formed. We
  should also run `mdbook test` on each language since the
  translations can alter the embedded code.

Fixes #115.

[1]: https://www.gnu.org/software/gettext/manual/html_node/index.html
[2]: https://github.com/rust-lang/mdBook/pull/1864
[3]:
https://github.com/rust-lang/mdBook/issues/5#issuecomment-1144887806
[4]: https://poedit.net/
[5]: https://pontoon.rust-lang.org/
2023-01-18 16:12:53 +01:00
8e3941d2e6 Fix close tag on keyboard shortcut page (#179) 2023-01-18 10:57:31 +00:00
0324cd2b27 Merge pull request #176 from google/testing
Fix Rustdoc comment.
2023-01-17 17:32:39 +01:00
8f6dcf35f5 Fix Rustdoc. 2023-01-17 16:07:10 +00:00
51ad97a8df Fix typo (#173) 2023-01-17 11:42:31 +00:00
13da3112e9 Ownership speaker notes (#172)
* ownership speaker notes

Co-authored-by: Martin Geisler <mgeisler@google.com>
2023-01-17 08:09:14 +00:00
b602dc9be4 Merge pull request #169 from google/intoiterator
Add some speaker notes for day 3 morning and a page about FromIterator
2023-01-16 21:31:09 +00:00
1c7ce1cac6 Use a consistent order in memory layout of trait objects example. 2023-01-16 16:11:31 +00:00
5cbb8d4c27 Add speaker notes about closures. 2023-01-16 16:11:31 +00:00
a1861ef900 Add speaker notes for impl Trait. 2023-01-16 16:11:31 +00:00
832c7e9963 Add speaker notes for Iterator, and an example using FromIterator. 2023-01-16 16:11:31 +00:00
61732adadd Merge pull request #164 from fbornhofen/speaker-notes-move
Add speaker notes for moves-function-calls.md
2023-01-16 11:34:02 +01:00
93b20be600 Hint towards making library mut
Follow up to https://github.com/google/comprehensive-rust/pull/137
Gives the student a hint that it's okay to edit variables within main.
2023-01-16 11:06:40 +01:00
4c8d85dc88 Fix typo in rust.md 2023-01-16 11:06:40 +01:00
71c68a6996 Adds speaker notes for 6.4.1. String vs str
Adds speaker notes including:
-Brief explanation of &str, String type
-String::from and String::new
-push_str method
2023-01-16 11:06:40 +01:00
d1dc1f466a Merge pull request #167 from sahennenkamp/patch-1
Hint towards making library mut
2023-01-14 08:07:10 +01:00
61163d019c Merge pull request #168 from baltuky/rust_memory_management_typo
Fix a typo on the Memory Management in Rust page
2023-01-14 08:06:33 +01:00
f118a78ef2 Fix typo in rust.md 2023-01-14 01:45:36 +01:00
fdf26a776f Hint towards making library mut
Follow up to https://github.com/google/comprehensive-rust/pull/137
Gives the student a hint that it's okay to edit variables within main.
2023-01-13 14:45:47 -08:00
74e2ba6acd Merge pull request #166 from rastringer/patch-1
Adds speaker notes for 6.4.1. String vs str
2023-01-13 14:05:19 +00:00
47435cbf41 Adds speaker notes for 6.4.1. String vs str
Adds speaker notes including:
-Brief explanation of &str, String type
-String::from and String::new
-push_str method
2023-01-13 13:14:19 +00:00