refactor(rust): shrink uniform API call errors - #143
Merged
Conversation
- Store private operation metadata and erased error state behind one allocation - Keep typed operation errors inline and preserve public error behavior - Add pointer-size coverage and regenerate all Rust backend clients
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make generated Rust
ApiCallErrorvalues pointer-sized by moving their privateoperation metadata and erased error state behind one
Box.Problem
ApiCallErrorpreviously stored its largest error variant inline, so everyerased error carried the full enum storage even though typed operation errors
remain the common representation before erasure.
Behavior
ApiCallErrorDisplay, andError::sourceDebugoutputCompatibility
Public error methods and calling semantics are unchanged. Constructing an
erased
ApiCallErrorperforms one heap allocation. The derivedDebugformatchanges intentionally; it is not treated as a stable string-processing API.
Validation
just fmt-checkjust clippycargo test api_call_error_cargo test --test typed_http_error_runtimejust golden-checkjust golden-rust::build(63/63 reqwest, 63/63 ureq, 63/63 aioduct)cargo test --doc --workspacejust test-all(1303/1304 passed locally; the Kotlin charset smoke test wasblocked by the local Kotlin compiler rejecting Java
26.0.2)