Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Project Setup

This page covers the requirements and setup for developing cascette-rs.

Requirements

Rust Toolchain

  • Minimum Supported Rust Version (MSRV): 1.92.0
  • Edition: Rust 2024

Install the required toolchain:

rustup install 1.92.0
rustup default 1.92.0

Required components:

rustup component add rustfmt clippy

For WASM development:

rustup target add wasm32-unknown-unknown

Development Tools

ToolPurposeInstallation
cargo-denyDependency auditingcargo install cargo-deny
cargo-nextestTest runnercargo install cargo-nextest
cargo-llvm-covCode coveragecargo install cargo-llvm-cov
mdbookDocumentationcargo install mdbook or via mise install

Optional Tools

ToolPurposeInstallation
ripgrepCode searchcargo install ripgrep or system package
hyperfineBenchmarkingcargo install hyperfine
cargo-watchAuto-rebuildcargo install cargo-watch

Repository Structure

cascette-rs/
├── crates/                    # Workspace members
│   ├── cascette-crypto/       # Cryptographic primitives
│   ├── cascette-formats/      # Binary format parsers
│   └── ...
├── docs/                      # mdBook documentation
│   ├── src/                   # Documentation source
│   └── book.toml              # mdBook configuration
├── deny.toml                  # cargo-deny configuration
├── Cargo.toml                 # Workspace manifest
└── AGENTS.md                  # AI assistant guidance

First-Time Setup

  1. Clone the repository:

    git clone https://github.com/wowemulation-dev/cascette-rs.git
    cd cascette-rs
    
  2. Verify the toolchain:

    rustc --version  # Should be 1.92.0 or later
    cargo --version
    
  3. Build the workspace:

    cargo build --workspace
    
  4. Run tests:

    cargo nextest run --workspace
    
  5. Verify lints pass:

    cargo fmt --all -- --check
    cargo clippy --workspace --all-targets
    

IDE Configuration

VS Code

Recommended extensions:

  • rust-analyzer - Rust language support
  • Even Better TOML - TOML file support
  • crates - Dependency version management

Settings (.vscode/settings.json):

{
  "rust-analyzer.check.command": "clippy",
  "rust-analyzer.check.allTargets": true,
  "editor.formatOnSave": true,
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer"
  }
}

JetBrains (RustRover/IntelliJ)

  • Install the Rust plugin
  • Enable “Run rustfmt on save”
  • Configure clippy as the external linter

Quality Gate

All changes must pass the CI workflow before merging. Run these checks locally:

# Full CI check (run before committing)
cargo fmt --all -- --check && \
cargo clippy --workspace --all-targets && \
cargo nextest run --profile ci --workspace && \
cargo doc --workspace --no-deps

Individual checks:

CommandPurpose
cargo fmt --all -- --checkFormat verification
cargo clippy --workspace --all-targetsLint checks
cargo nextest run --profile ci --workspaceUnit and integration tests
cargo doc --workspace --no-depsDocumentation build
cargo deny checkDependency audit

WASM Compatibility

Core libraries must compile to WASM:

cargo check --target wasm32-unknown-unknown -p cascette-crypto
cargo check --target wasm32-unknown-unknown -p cascette-formats

Documentation

Build and serve the documentation locally:

# Build HTML documentation
mdbook build docs

# Serve locally with auto-reload
mdbook serve docs --open

The documentation will be available at http://localhost:3000.

Workspace Configuration

The workspace uses strict linting. Key settings from Cargo.toml:

[workspace.lints.clippy]
# Lint groups
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
cargo = { level = "warn", priority = -1 }

# Safety lints (higher priority)
unwrap_used = { level = "warn", priority = 2 }
panic = { level = "warn", priority = 2 }
todo = { level = "warn", priority = 2 }
unimplemented = { level = "warn", priority = 2 }
expect_used = { level = "warn", priority = 2 }

Library code should avoid unwrap(), expect(), and panic!(). Use Result types and proper error handling instead.