Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Avhz RustQuant Rust Stable

From Leeroopedia


Knowledge Sources
Domains Infrastructure, Quantitative_Finance
Last Updated 2026-02-07 19:00 GMT

Overview

Rust stable toolchain environment with edition 2021, Cargo workspace resolver 2, and 16 internal crates for building the RustQuant quantitative finance library.

Description

This environment provides the complete Rust build context for the RustQuant library. It uses the stable Rust toolchain (no nightly features required) with edition 2021 and Cargo's resolver 2 for dependency resolution. The workspace contains 16 internal crates covering autodiff, instruments, stochastics, math, time, trading, data, ML, portfolios, ISO codes, cashflows, error handling, utilities, models, pricing, and enums. External dependencies include numerical computing libraries (nalgebra, ndarray with rayon parallelism), optimization (argmin), statistical distributions (statrs, rand_distr), and Python bindings (pyo3).

Usage

Use this environment for all compilation and testing of the RustQuant library. It is the mandatory prerequisite for every Implementation page in this wiki. The CI pipeline tests on Ubuntu latest with the stable Rust toolchain.

System Requirements

Category Requirement Notes
OS Ubuntu Latest (CI) Other platforms supported for Python bindings (Windows, macOS)
Rust Toolchain Stable channel No nightly features required
Rust Edition 2021 Workspace-wide setting in root Cargo.toml
Cargo Resolver 2 Required for workspace dependency resolution
Disk ~500MB For build artifacts and dependency cache

Dependencies

System Packages

  • Rust stable toolchain (via `rustup`)
  • `cargo` (included with Rust)
  • `git` (for source checkout)

Rust Crates (Workspace Dependencies)

Numerical Computing:

  • `nalgebra` = 0.33.0
  • `ndarray` = 0.16.1 (with `rayon` feature)
  • `ndrustfft` = 0.5.0
  • `ndarray-rand` = 0.15.0
  • `num` = 0.4.1 (with `rand` feature)
  • `errorfunctions` = 0.2.0

Optimization:

  • `argmin` = 0.10.0
  • `argmin-math` = 0.4.0
  • `finitediff` = 0.1.4

Random & Statistics:

  • `rand` = 0.8.5
  • `rand_distr` = 0.4.3
  • `statrs` = 0.17.1

Data & Serialization:

  • `serde` = 1.0.213 (with `derive` feature)
  • `polars` = 0.44.0 (with `docs-selection` feature)
  • `rust_decimal` = 1.34.3

Time & Calendar:

  • `time` = 0.3.34 (with `macros` feature)
  • `icu` = 1.5.0

Utilities:

  • `derive_builder` = 0.20.0
  • `log` = 0.4.22
  • `thiserror` = 1.0.57
  • `rayon` = 1.9.0
  • `plotly` = 0.10.0

Python Bindings (optional):

  • `pyo3` = 0.26.0 (with `time` feature)

CI Tools

  • `cargo-tarpaulin` (code coverage)
  • `clippy-sarif` + `sarif-fmt` (lint reporting)
  • `mdbook` (documentation)
  • `maturin` >= 1.9, < 2.0 (Python bindings build)

Credentials

No credentials or environment variables are required for building and testing the core library. The Python bindings CI requires PyPI credentials for release publishing only.

Quick Install

# Install Rust stable toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable

# Clone and build
git clone https://github.com/avhz/RustQuant.git
cd RustQuant
cargo build --release

# Run all tests
cargo test --all

# Build Python bindings (optional)
cd bindings
pip install maturin
maturin develop --release

Code Evidence

Workspace configuration from `Cargo.toml:10-29`:

[workspace.package]
authors = ["avhz <RustQuantContact@gmail.com>"]
description = "A Rust library for quantitative finance."
version = "0.4.0"
edition = "2021"

[workspace]
resolver = "2"
members = [ "crates/*", "examples", "bindings" ]

Lint configuration enforcing documentation from `Cargo.toml:31-37`:

[workspace.lints.rust]
missing_docs = "forbid"
non_snake_case = "allow"

[workspace.lints.clippy]
undocumented_unsafe_blocks = "forbid"

CI toolchain selection from `.github/workflows/cargo_clippy.yml`:

- name: Install Rust toolchain
  uses: dtolnay/rust-toolchain@stable
  with:
    components: clippy

Common Errors

Error Message Cause Solution
`error: package requires edition 2021` Rust toolchain too old Update via `rustup update stable`
`error[E0433]: failed to resolve: use of undeclared crate` Missing workspace member Run `cargo build` from workspace root, not individual crate
`note: the cargo feature 'resolver' is required` Cargo version too old Update via `rustup update stable`
`maturin: command not found` Maturin not installed for Python bindings `pip install maturin`

Compatibility Notes

  • Python Bindings: Require Python >= 3.8 and maturin >= 1.9. Supported platforms: Linux (glibc and musl, x86_64/aarch64/armv7), Windows (x64/x86), macOS (Intel and ARM).
  • Parallel Computation: Uses `rayon` for data parallelism. Thread count defaults to available CPU cores. Can be controlled via `RAYON_NUM_THREADS` environment variable.
  • KaTeX Rendering: Documentation uses KaTeX for math rendering via `--html-in-header katex.html` rustdoc flag.
  • Release Profile: A custom `release-with-debug` profile is available for profiling: `cargo build --profile=release-with-debug`.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment