Skip to content

simsekgokhan/my_rust_templates

Repository files navigation

Integ_Tests Clippy integration_tests unit_tests

rust-my-templates

This repo is for my personal use with tips, tools, ready to use examples/explanations of features/keywords of Rust and best practices.

Important tools & tips:

. 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
. Use cargo 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)
. Use sccache for faster builds (see setup and how to use in section "docs" below)
. Use .cargo/config.toml (see faster_builds_with_linker_config in section "docs" below)
. Use debugger (see vscode debugger setup, examples in section "docs" below) or use RUST_BACKTRACE=1 cargo run . . .
. Use cargo tree - displays the dependency graph

faster_builds_with_linker_config.md
faster_builds_with_sccache.md
how_to_debug_rust.md

hello.rs

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

Sources:

What's more in this repo?

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages