Comments (2)
Hey, just a quick comment for one part above:
The getters and setters here aren't very idiomatic. First of all, nothing here is public -- everything must be in the same module -- so you'd just access the fields directly. Second of all, instead of a getter an infallible setter, if the struct was public, you'd probably just make those fields public too. If the fields actually have invariants, the setters shouldn't be infallible, but instead return a
Result<_, _>
.More generally, it may give the impression that using getters and setters is idiomatic (even in the same module).
Yes, I agree with you, I should change these getters to do something more complicated.
Perhaps note this list of receivers is non-exhaustive. E.g. Box.
Yeah, thanks!
from comprehensive-rust.
I think you should show the Option and Result definitions here. They'll see the variants everywhere in Rust.
When teaching, the definition of Option
often comes up before the standard library slides are even reached. In any case, whenever going through the standard library slides the slide provides an introduction to the type with usage context and then the standard library docs are the destination for the precise definition if public and to dive deeper into the available methods. See #2248.
Clarify that a HashMap doesn't have to be keyed with a &str or String (unlike a JSON object, say).
This becomes clear on the next slide as well as in the standard library docs where the K, V, and S type parameters are all worth discussing.
These are no longer present, but this exercise could admittedly use some work (#1513).
I don't know that "omitted" is the right term for mod in_another_file;.
To me it makes sense--the body of the mod
item is not present in this file, i.e. it is omitted.
from comprehensive-rust.
Related Issues (20)
- Most code snippets don't work anymore HOT 2
- Dead link found in the glossary.md translations HOT 1
- Korean (ko): Catch-up with EN version
- Spanish (es): Catch-up with EN version HOT 19
- Brazilian Portuguese (pt-BR): Catch-up with EN version
- Chinese Simplified (zh-CN): Catch-up with EN version
- Chinese (Traditional) (zh-TW): Catch-up with EN version
- Make `Fork` useful in Dinning Philosopher exercises HOT 1
- The language switching menu requires clicking on the text, not elsewhere in the menu item HOT 5
- dprint fmt failing HOT 2
- Local `dprint` and `dprint` in CI want opposite things HOT 1
- Rust
- Automated slide size analysis with a new slide scoring tool HOT 2
- Non-lexical lifetimes on exclusive reference HOT 1
- Link check runs on all languages HOT 2
- Write our own summaries of std types' API surface HOT 1
- Swap order of Cell/RefCell HOT 1
- Fn traits slide is more confusing than necessary
- How to create the translations drop down? HOT 1
- Casting chapter's one sentence understanding HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comprehensive-rust.