reading/how_not_to_learn_rust
how_not_to_learn_rust
dz /
reading /
how_not_to_learn_rust
Summary
Reading: How not to learn rust
Node Tree
Nodes
top
|
content
|
top
|
children
|
rust/crates/regex (mentioned in reading)
|
location
|
knowledge/how_not_to_learn_rust.dz:4
|
not_prepared_high_step
|
content
|
mistake 1: not prepared for first high step. stop trying without trying, and put in the time. Lots of new things to learn.
|
location
|
knowledge/how_not_to_learn_rust.dz:11
|
dive_in_without_book
|
content
|
mistake 2: dive in without reading "the book"
|
location
|
knowledge/how_not_to_learn_rust.dz:16
|
make_a_graph
|
content
|
mistake 3: start by implementing a graph algorithm. this is a variation on "don't make a linked list" the language makes it very hard to do build these kind of structures.
|
location
|
knowledge/how_not_to_learn_rust.dz:19
|
dont_read_compiler_errors
|
content
|
mistake 4: don't read compiler errors. Rust's compiler is a good teacher and precisely explains problem. Newbies should use "cargo check".
|
children
|
reddit_cargo_check (follow-up on cargo check)
|
location
|
knowledge/how_not_to_learn_rust.dz:25
|
ignore_compiler_warnings
|
content
|
mistake 5: ignore compiler warnings. Also recommended: cargo clippy
|
location
|
knowledge/how_not_to_learn_rust.dz:36
|
rust_functional
|
content
|
insist to make it functional. Rust solves problems that functional programming tries to solve in different ways. Ownership isn't just about memory safety: one mutable reference means most sources of data inconsistencies are removed, without going functional.
|
parents
|
best_practices_other_languages
|
location
|
knowledge/how_not_to_learn_rust.dz:47
|
rust_dynamic
|
content
|
try to make it dynamic. Instead of writing functions that take in one trait A and return trait B (uses dyn box, some overhead), take advantage of generics. Use dyn sparingly.
|
parents
|
best_practices_other_languages
|
location
|
knowledge/how_not_to_learn_rust.dz:55
|
getters
|
content
|
fine-tune privacy and data protection with getters. Rust fixes this with ownership. Rust most often reaches this goal by letting your types be essentially consistent.
|
parents
|
best_practices_other_languages
|
location
|
knowledge/how_not_to_learn_rust.dz:67
|
build_lifetime_heavy_API
|
content
|
mistake 7: build lifetime-heavy API. When designing structs of a new library, prefer to own the data. Don't prematurely optimize with reference-based structs.
|
remarks
|
author learned lesson hard way with library termimad
|
hyperlink
|
https://github.com/Canop/termimad
|
location
|
knowledge/how_not_to_learn_rust.dz:83
|
ignore_non_standard_libs
|
content
|
mistake 8: ignore non-standard libraries. try to find "kind of standard libraries".
|
location
|
knowledge/how_not_to_learn_rust.dz:90
|
use_unsafe_abuse_unwrap
|
content
|
mistake 9: use unsafe. abuse unwrap. Intermediate solution: use expect. Pick one of the error libraries.
|
location
|
knowledge/how_not_to_learn_rust.dz:95
|
dont_look_at_sources
|
content
|
mistake 10: don't look at the sources.
|
location
|
knowledge/how_not_to_learn_rust.dz:99
|
design_everything_at_start
|
content
|
mistake 11: design everything at start. Rust will surprise you, and compiler makes it easy to refactor because it will guide you to consistency.
|
location
|
knowledge/how_not_to_learn_rust.dz:102
|
learn_wrong_rust
|
content
|
If you're using these keywords in your program, you might be learning rust the wrong way: Rc, dyn, unsafe, Deref
|