Since most developers on the project are new to rust, I thought it would be useful to have an issue to discuss tips for onboarding. Feel free to edit or comment.
IDEs
Intellij (or related IDEs) have a rust plugin that is pretty solid, with some tweaks:
Check everything under Editor > General > Auto Import.
VSCode or other LSP editors with rust-analyze is also great.
Note: due to the complexity of the language, the experience of both of these is still worse than Go unfortunately
Useful commands
cargo build # build in debug mode
cargo build --release # build in release mode - takes a while, but gives an optimized build. Do not benchmark without --release!!!
cargo check [--tests] # quickly check for compile errors
cargo clippy --fix --allow-staged --allow-dirty # find and fix (sometimes) lint errors
cargo fmt # format things
Rust allows a wide variety of coding styles. Because most developers on the project are new-er to Rust, avoid use of complex Rust features when possible. If a function doesn't need to be generic, do not make it so. If a we can save 10nanoseconds on a infrequent codepath by using complex lifetimes - opt for a clone() instead.
Since most developers on the project are new to rust, I thought it would be useful to have an issue to discuss tips for onboarding. Feel free to edit or comment.
IDEs
Intellij (or related IDEs) have a rust plugin that is pretty solid, with some tweaks:
VSCode or other LSP editors with rust-analyze is also great.
Note: due to the complexity of the language, the experience of both of these is still worse than Go unfortunately
Useful commands
Resources
https://doc.rust-lang.org/book/ - the canonical learning rust book.
https://www.zero2prod.com/ - good real world walkthrough
https://tokio.rs/tokio/tutorial - good intro to async and tokio (library we use)
Coding style
Rust allows a wide variety of coding styles. Because most developers on the project are new-er to Rust, avoid use of complex Rust features when possible. If a function doesn't need to be generic, do not make it so. If a we can save 10nanoseconds on a infrequent codepath by using complex lifetimes - opt for a clone() instead.
Running locally
See https://github.com/istio/ztunnel/blob/master/LOCAL.md
Useful tools
https://nexte.st/ - Better test runner