Rust Development Environment Setup
Relevant Rust source files
rust-toolchain.tomlCargo.tomlMakefiletools.toml.pre-commit-config.yamlscripts/ci/install-rust.shscripts/ci/install-prek.sh
The pinned checkout requires the stable Rust 1.97.0 toolchain. Let rustup honor rust-toolchain.toml; do not replace it with an unrecorded local override. Install the components used by the repository gates, including rustfmt and Clippy.
Initial setup
rustup show
cargo install cargo-binstall --locked
make install-tools
prek install
cargo metadata --no-deps --format-version 1
make install-tools is the upstream installer for pinned development utilities. prek runs the repository’s pre-commit configuration. The final metadata command verifies that Cargo can resolve the workspace before a long build begins.
Native dependencies
Some features require system libraries or tools: Cap’n Proto compilation, TLS/crypto dependencies, database clients, and platform C toolchains are examples. Install only what the selected crate and feature set needs. A model-only change should not require live adapters or database services.
Redis and PostgreSQL are optional infrastructure backends, not prerequisites for every unit test. Use the repository’s container and test commands when exercising those integrations; do not substitute an arbitrary local version and assume parity.
Focused checks
cargo fmt --all -- --check
cargo clippy -p nautilus-model --all-targets -- -D warnings
cargo nextest run -p nautilus-model
cargo test -p nautilus-testkit
Replace the package with the owning crate. Adapter work should also build and run the selected example feature set. Databento examples require credentials only for live provider access; unit decoding should use fixtures. Interactive Brokers live examples require a running TWS or Gateway and must use isolated client identifiers.
Precision and feature parity
Test the precision mode and default-feature policy used by the final binary. High precision changes integer widths and may not be supported on every target. A local all-defaults build can hide missing imports or behavior in a minimal consumer.
Keep provider keys and broker credentials outside shell history and repository files. Verify secret presence, not value, in diagnostics.