- Build an idiomatic Rust implementation of MiniExcel behavior, using the .NET MiniExcel project as the compatibility reference.
- Preserve Rust performance, memory safety, and API conventions. Match observable behavior; do not translate .NET internals literally.
- Treat docs/compatibility.md as the current scope and architecture record. Do not claim unsupported surfaces as equivalent.
- The .NET reference checkout is normally the sibling repository
../MiniExcel(D:\git\MiniExcelon the primary Windows development machine). - Before implementing parity behavior, inspect the corresponding .NET public API, controlling implementation, and focused tests.
- Do not modify the .NET repository unless the task explicitly requires it.
tests/data/contracts/xlsx-parity-v1.jsonis the shared behavior contract. Update it deliberately and validate both adapters when changing covered behavior.
- The workspace contains
miniexcel(core library),miniexcel-cli(CLI), andminiexcel-wasm(browser adapter). - Keep
MiniExcelas the main public facade. Keep parser, reader, writer, and concrete iterator types internal unless a public abstraction is required. - Path-based
queryandquery_asmust remain bounded-memory streams. Do not retain complete worksheet XML or all rows. - Prefer sequential ZIP/XML passes, small parser state, and bounded channels over workbook-wide materialization. Byte-array APIs may materialize results when their contract requires it.
- Use structured XML, ZIP, and serialization APIs. Avoid ad hoc string parsing when an existing parser or typed helper applies.
- Preserve workbook order and Excel coordinate semantics. Public indices are 1-based; internal cell coordinates may remain 0-based.
- Writing creates new XLSX workbooks. Do not imply support for editing existing files unless that capability is explicitly implemented and tested.
- Support Rust 1.85.0 and Edition 2024. Do not use features newer than the declared MSRV.
- Unsafe Rust is forbidden across the workspace.
- Reuse existing crate patterns and dependencies before adding abstractions or packages.
- Keep changes focused. Do not rewrite unrelated code or overwrite existing working-tree changes.
- Add regression tests from existing fixtures when possible. Put shared .NET/Rust expectations in the parity contract only when both adapters cover the behavior.
- Update the compatibility matrix and public documentation when support boundaries or APIs change.
- Keep a complete
.zh-CN.mdcounterpart for every English Markdown document, with reciprocal language links, and update both versions together.
web-demois a backend-free static application. XLSX parsing and generation run locally in the browser throughminiexcel-wasm; do not introduce a server API or upload workbook data unless explicitly requested.- Prerequisites are Node.js 22, the
wasm32-unknown-unknownRust target, andwasm-bindgen-cliversion 0.2.127:
rustup target add wasm32-unknown-unknown --toolchain 1.85.0
cargo +stable install wasm-bindgen-cli --version 0.2.127 --locked- To build and run locally, use
npm run devfromweb-demo, then openhttp://127.0.0.1:4173:
cd web-demo
npm ci
npm run devnpm run buildproduces a deployable static site inweb-demo/dist, including the HTML, CSS, JavaScript, and WebAssembly assets. It can be deployed directly to GitHub Pages or another static host; no .NET or Rust server process is required at runtime.- Serve
distover HTTP withnpm run serveor another static server. Do not rely on openingdist/index.htmlthroughfile://, because browser module and WebAssembly loading requires correct HTTP behavior and MIME types. - Keep browser tests covering both desktop and mobile viewports. The current Playwright configuration starts the local static server automatically.
Run the narrowest relevant test immediately after the first substantive edit. Before completion, run the applicable CI checks from the repository root:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --all-targets --locked
cargo doc --workspace --no-deps --lockedFor shared .NET parity changes, run both adapters:
cargo +1.85.0 test -p miniexcel --test parity_contract --locked
dotnet test ../MiniExcel/tests/MiniExcel.OpenXml.Tests/MiniExcel.OpenXml.Tests.csproj --framework net10.0 --filter "FullyQualifiedName~RustParityContractTests"For browser or WASM changes, also run from web-demo:
npm ci
npm run build
npm run test:e2eIf an environment cannot run an applicable check, report that limitation explicitly.