Skip to content

[QDP] Rust code quality and website improvements for Apache Mahout (QDP & site) #1080

@rich7420

Description

@rich7420

Background

  • QDP: GPU-accelerated quantum state encoding with a Rust core (qdp-core), CUDA kernels (qdp-kernels), and PyO3 bindings (qumat.qdp / _qdp). Keeping the Rust stack in good shape and visible (e.g. via rustdoc) is part of project health.
  • Website: Built with Docusaurus; docs/ is the source of truth. Work here includes site code (config, scripts, components), fixing link and nav issues, integrating API docs, and CI.

Project context

  • QDP encodings: qdp/qdp-core/src/gpu/encodings/QuantumEncoder trait, get_encoder, encodings: amplitude, angle, basis, iqp.
  • Website: Docusaurus 3.x; source of truth docs/ (sync script copies into website/ before build).
  • QDP API: Encoding methods "amplitude" | "angle" | "basis" | "iqp" | "iqp-z"; see docs/qdp/api.md.

Concrete improvements

Rust (QDP)

  • Unsafe scope refactor: Narrow unsafe blocks; keep setup/teardown outside; add // SAFETY: where needed; avoid new broad unsafe regions.
  • Doc coverage: Add or fix /// / //! for public items (first-line summary; optional # Examples / # Panics). Use cargo doc --no-depstarget/doc/.
  • Lints and style: Fix cargo clippy warnings; remove dead code and unused imports; rustfmt.
  • Small refactors: Extract helpers, clarify names, shorten long functions; no behavior change.
  • Tests: Add or tighten unit tests where coverage is low; keep tests fast and deterministic.

Website

  • Link errors: Fix broken links, wrong URLs, and redirect issues in docs/ and the built site.
  • Site programming: Fix or improve Docusaurus config, sync scripts, or components.
  • Nav and sidebar: Align labels and order with content; fix inconsistencies.
  • Doc build in CI: Run cargo doc --no-deps (and optionally Python doc generation); fail on errors.
  • Placeholders: Replace "TODO: Add API reference" with a link or short summary.

Deliverables (suggested)

  • Rust: At least one concrete improvement (e.g. unsafe refactor, doc coverage, or small refactor) with tests; notes in PR where useful.
  • Rust docs: Public API in qdp-core documented for cargo doc --no-deps; optionally wired into the doc pipeline.
  • Website: At least one of: site programming, link fixes, API doc integration, or CI doc builds.
  • Docs: Short note in docs/ or CONTRIBUTING on Rust doc conventions and where to find rustdoc.

References (official dev docs)

Resource URL
Rust doc.rust-lang.org
rustdoc doc.rust-lang.org/rustdoc/
How to write documentation doc.rust-lang.org/rustdoc/how-to-write-documentation.html
cargo doc doc.rust-lang.org/cargo/commands/cargo-rustdoc.html
RFC 505 (API comments) rust-lang.github.io/rfcs/0505-api-comment-conventions.html
Rust CUDA (guide) rust-gpu.github.io/rust-cuda
NVIDIA CUDA best practices docs.nvidia.com/cuda/cuda-c-best-practices-guide
Docusaurus docusaurus.io

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions