Skip to content

feat(rust): add schema-aware incremental item writer (#127) - #149

Merged
nth-bailey merged 3 commits into
mainfrom
feat/127-incremental-xml-writer
Oct 11, 2026
Merged

nth-bailey merged 3 commits into
mainfrom
feat/127-incremental-xml-writer

Conversation

@nth-bailey

Copy link
Copy Markdown
Collaborator

Summary

Closes #127.

Adds a schema-aware incremental item producer (write_<root>_items) for plain sequence root elements with one repeated child collection. Instead of requiring a complete materialized object tree in memory, the producer consumes items lazily from an iterator and streams directly to any std::io::Write sink with bounded O(1) memory.

Key Changes

  • Rust Codegen (polyxml-core): Emits pub fn write_<root>_items for eligible sequence roots, handling root opening/closing tags, root namespaces, child item encoding, text escaping, and minOccurs/maxOccurs occurrence bounds.
  • Verification Harness (scripts/verify_incremental_writer.py): Tests both borrowed and owned generated models, verifying minimum/maximum occurrences, empty optional collections, sink failures, lazy iterator consumption, and independent libxml2 streaming XSD validation.
  • Documentation & Benchmarks (docs/benchmarks/incremental-writer.md): Records peak resident memory across 1K, 100K, and 1M items (~2.5 MiB flat RSS from 74 KB to 76.8 MB XML).
  • Language Guide (docs/languages/rust.md): Documents the incremental item writer API, distinguishing it from whole-model sink streaming.

@nth-bailey
nth-bailey merged commit a66d408 into main Oct 11, 2026
30 checks passed
@nth-bailey
nth-bailey deleted the feat/127-incremental-xml-writer branch October 11, 2026 14:17
nth-bailey pushed a commit that referenced this pull request Oct 11, 2026
# [0.35.0](v0.34.8...v0.35.0) (2026-10-11)

### Features

* **rust:** add schema-aware incremental item writer ([#127](#127)) ([#149](#149)) ([a66d408](a66d408))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Add schema-aware incremental writer for generated repeated items

1 participant