docs(arrow-convert): document and doctest the ArrowData read-back API - #3084
Conversation
`ArrowData`'s `TryFrom<&ArrowData>` implementations are the primary public API for reading received Arrow data back into Rust values, paired with `IntoArrow` for the send direction. `IntoArrow` carries a documented, compile-checked doctest, but the read-back side had none, and its non-obvious, load-bearing contract was only discoverable from the source: scalar conversions (`u8`, `f32`, `String`, ...) require exactly one element and no nulls, while slice/`Vec` conversions accept any length but reject nulls. Expand the `ArrowData` doc comment to describe both conversion shapes and their length/null contracts, with a compile-checked doctest that round-trips a scalar, a string, and a `Vec`, and shows that a multi-element array cannot be read as a scalar. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SD4dBVimzepwKSh2b9F8aG
|
😎 Merged successfully - details. |
|
🤖 Automated review by Claude — this is a fully automated review with no human in the loop. I reviewed this diff and found no issues. It is a docs-only change adding a doc comment plus a compile-checked doctest for Generated by Claude Code |
|
@phil-opp the Trunk merge queue failed for this PR. See the Trunk merge-status comment for details. Posted as a new comment so GitHub sends an email — Trunk's sticky comment is edited in place and won't trigger a notification. |
|
These The failing Verified locally on current Nothing to fix on this PR — it should re-test clean once the queue re-batches it without the offending sibling. Generated by Claude Code |
Issue
ArrowData'sTryFrom<&ArrowData>implementations (libraries/arrow-convert/src/from_impls.rs) are the primary public API for reading received Arrow data back into Rust values — the read-back counterpart toIntoArrow.IntoArrowhas a documented, compile-checked doctest (lib.rs), but the read-back side had none, and its non-obvious, load-bearing contract was only discoverable by reading the source:u8,f32,String,&str,chronotypes) require exactly one element and no nulls;Vecconversions accept any length but reject any nulls.Fix
Expand the
ArrowDatadoc comment to describe both conversion shapes and their length/null contracts, with a compile-checked doctest that:u8), aString, and aVec<i32>viatry_into(), andErr).Documentation only — no behavior change. This is a good fit for the "prefer compile-checked doctests" documentation goal: the doctest locks the contract against future drift.
Validation
cargo test -p dora-arrow-convert --doc— 2 passed (the newArrowDatadoctest plus the existingIntoArrowone).cargo fmt --all -- --checkandcargo clippy -p dora-arrow-convert -- -D warningsclean.🤖 This is a machine-generated pull request opened by Claude Code as part of an automated code-review pass. Please review carefully before merging.
🤖 Generated with Claude Code
Generated by Claude Code