You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-27 19:18:59 +02:00
Comprehensive Rust v2 (#1073)
I've taken some work by @fw-immunant and others on the new organization of the course and condensed it into a form amenable to a text editor and some computational analysis. You can see the inputs in `course.py` but the interesting bits are the output: `outline.md` and `slides.md`. The idea is to break the course into more, smaller segments with exercises at the ends and breaks in between. So `outline.md` lists the segments, their duration, and sums those durations up per-day. It shows we're about an hour too long right now! There are more details of the segments in `slides.md`, or you can see mostly the same stuff in `course.py`. This now contains all of the content from the v1 course, ensuring both that we've covered everything and that we'll have somewhere to redirect every page. Fixes #1082. Fixes #1465. --------- Co-authored-by: Nicole LeGare <dlegare.1001@gmail.com> Co-authored-by: Martin Geisler <mgeisler@google.com>
This commit is contained in:
committed by
GitHub
parent
ea204774b6
commit
6d19292f16
45
src/std-types/docs.md
Normal file
45
src/std-types/docs.md
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
minutes: 5
|
||||
---
|
||||
|
||||
# Language Docs
|
||||
|
||||
Rust comes with extensive documentation of the language and the standard library.
|
||||
|
||||
For example:
|
||||
* All of the details about [loops](https://doc.rust-lang.org/stable/reference/expressions/loop-expr.html).
|
||||
* Primitive types like [`u8`](https://doc.rust-lang.org/stable/std/primitive.u8.html).
|
||||
* Standard-library items like [`Option`](https://doc.rust-lang.org/stable/std/option/enum.Option.html) or [`BinaryHeap`](https://doc.rust-lang.org/stable/std/collections/struct.BinaryHeap.html).
|
||||
|
||||
In fact, you can document your own code:
|
||||
|
||||
```rust,editable
|
||||
/// Determine whether the first argument is divisible by the second argument.
|
||||
///
|
||||
/// If the second argument is zero, the result is false.
|
||||
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
|
||||
if rhs == 0 {
|
||||
return false;
|
||||
}
|
||||
lhs % rhs == 0
|
||||
}
|
||||
```
|
||||
|
||||
The contents are treated as Markdown. All published Rust library crates are
|
||||
automatically documented at [`docs.rs`](https://docs.rs) using the
|
||||
[rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) tool. It is
|
||||
idiomatic to document all public items in an API using this pattern.
|
||||
|
||||
To document an item from inside the item (such as inside a module), use `//!`
|
||||
or `/*! .. */`, called "inner doc comments":
|
||||
|
||||
```rust,editable
|
||||
//! This module contains functionality relating to divisibility of integers.
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
* Show students the generated docs for the `rand` crate at
|
||||
[`docs.rs/rand`](https://docs.rs/rand).
|
||||
|
||||
</details>
|
Reference in New Issue
Block a user