This repo is for my personal use with tips, tools, ready to use examples/explanations of features/keywords of Rust and best practices.
. Use latest Rust & read release notes -> https://github.com/rust-lang/rust/releases
. Follow surveys/latest trends -> e.g. https://www.jetbrains.com/lp/devecosystem-2023/rust/
. Use & study latest edition -> https://doc.rust-lang.org/edition-guide
. Usecargo check
to speed up the development (cargo check
performs compilation checks without generating machine code)
. Use clippy - the Rust linter (also use it in CI: clippy.yml)
. Use rust-analyzer
. Use integration_tests (also use it in CI: integration_tests.yml)
. Use unit_test (also use it in CI: unit_tests.yml)
. Usesccache
for faster builds (see setup and how to use in section "docs" below)
. Use .cargo/config.toml (seefaster_builds_with_linker_config
in section "docs" below)
. Use debugger (see vscode debugger setup, examples in section "docs" below) or useRUST_BACKTRACE=1 cargo run . . .
. Usecargo tree
- displays the dependency graph
faster_builds_with_linker_config.md
faster_builds_with_sccache.md
how_to_debug_rust.md
async_.rs
averaged_collection.rs
cacher.rs
clap-cmd-line-parser
compile_vs_runtime_read_env_and_file.rs
concurrency.rs
const_fn.rs
constructor_chain.rs
doc_test.rs
drop_aka_dtor.rs
dynamically_sized_types.rs
enum.rs
error_handling.rs
func_ptr.rs
int_overflow.rs
interior_mutability.rs
iterators_aka_algorithms.rs
let_else.rs
match_.rs
never_type_never_returns.rs
newtype_pattern.rs
re_export.rs
serde_json.rs
smart_ptrs.rs
string_concat.rs
trait_simple_vs_enum.rs
traits_return_impl.rs
traits_associated_constants.rs
traits_default_type_parameter.rs
traits_object_vs_struct_obj.rs
traits_return_impl.rs
traits_same_name_fn_call.rs
traits_supertraits.rs
traits_when_to_use_dyn_dispatch.rs
type_.rs
unit_integration_tests.rs
unit_tested_file.rs
web-server-async-and-parallel
web-server-multi-threaded
- Rust Programming Language Book by Steve Klabnik
- Rust in Action – 2021 by Tim McNamara
- Effective Rust - 35 Specific Ways to Improve Your Rust Code by David Drysdale
- Rust API Guidelines
- Rust for Rustaceans Idiomatic Programming for Experienced Developers - 2021 - by Jon Gjengset
- Organization of main.rs, lib.rs and unit tests
- Working with command line arguments
- Working with environment variables
- Simple Cacher struct -> src/cacher.rs
- Examples of using closures -> src/closure.rs
- Debugging,
.vscode/launch.json
template .cargo/config.toml
sample, including fastest linkers, very&more useful for big codebases- Read from file, find lines that contains a string
- And more. . . see -> src/*.rs