Skip to content

Add examples of Rust, and release the crate to crates.io - #28

Merged
nickyoung-github merged 2 commits into
masterfrom
feature/rust-parquet-example
Nov 29, 2026
Merged

nickyoung-github merged 2 commits into
masterfrom
feature/rust-parquet-example

Conversation

@nickyoung-github

Copy link
Copy Markdown
Owner

Two examples of Rust, and what a project of Rust needs to depend on dataclass-native's crate: that it is on crates.io.

Examples

  • examples/parquet-rust: a program of Rust alone which writes orders as Parquet files and reads them back, with arrow-rs's parquet. As the C++ example of Parquet, with its schema and its orders. src/parquet_files.rs is what to copy from: to_parquet and from_parquet, of the files which Python's write and read.
  • examples/functions-rust: an extension in Rust built with maturin. As the C++ example of functions, with its schema, functions and demo. Its functions are plain Rust of the generated structs, and its lib.rs is what gives them to Python.
  • In each, build.rs generates the Rust from the Python schema when the crate is built.

The crate, on crates.io

  • dataclass_native is no longer publish = false, and has a version, 1.2.0, which is to be that of the Python package it is released with.
  • The release workflow first checks that the crate's version is the tag's, and releases neither if it is not: then releases the crate, with the secret CARGO_REGISTRY_TOKEN, as well as the package.
  • README and DESIGN say to depend on the crate by that version, or by path, where dataclass-native rust-dir prints.

Also

  • The Rust generated for an extension no longer warns of what it does not use, of a schema with no union or no class which is not frozen.
  • The README's introduction and status, as rewritten.

Tested: each example is built with cargo by a test, which runs it. Of the Parquet, Python reads what Rust wrote, and Rust what Python wrote. Of the extension, its demo gives the same in each mode. Checked by hand, and not by a test: maturin build makes a wheel of the extension which installs and runs; Rust reads the Parquet which the C++ example writes; and cargo publish --dry-run packages the crate.

To release: tag v1.2.0, once this is merged.

@nickyoung-github
nickyoung-github merged commit fd33416 into master Nov 29, 2026
6 checks passed
@nickyoung-github
nickyoung-github deleted the feature/rust-parquet-example branch November 29, 2026 23:17
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.

1 participant