-
Notifications
You must be signed in to change notification settings - Fork 0
docs: mark response/result structs #[non_exhaustive] (whatsapp-rust#794) #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
facf9e5
docs: add changelog entry and #[non_exhaustive] notes for PR #794
jlucaso1 00ba859
docs: annotate SendResult, UploadResponse, CreateGroupResult, Partici…
jlucaso1 a90dce2
docs: add #[non_exhaustive] to UploadResponse and groups structs
jlucaso1 fcf9900
docs: fix #[non_exhaustive] notes to mention struct-literal construction
jlucaso1 e27ac57
docs: fix SendResult #[non_exhaustive] note wording
jlucaso1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| title: "June 9, 2026 — Response structs marked #[non_exhaustive]" | ||
| description: "All library-returned response and result structs are now #[non_exhaustive], completing the pre-1.0 API stabilisation pass." | ||
| --- | ||
|
|
||
| ## Breaking changes | ||
|
|
||
| **Response and result structs are `#[non_exhaustive]` ([#794](https://github.com/oxidezap/whatsapp-rust/pull/794))** | ||
|
|
||
| `#[non_exhaustive]` has been applied to all public structs the library returns to consumers but never requires consumers to construct. `IsOnWhatsAppResult` already carried the attribute; this pass extends it to the remaining types before 1.0, while adding new fields is still cheap. | ||
|
|
||
| **Affected types:** | ||
|
|
||
| *wacore:* | ||
| - `UserInfo`, `LidQueryResponse` | ||
| - `BusinessProfile`, `BusinessHours`, `BusinessHoursConfig`, `BusinessCategory` | ||
| - `GroupInfoResponse`, `GroupParticipantResponse`, `GroupParticipatingResponse`, `ParticipantChangeResponse` | ||
|
|
||
| *whatsapp-rust:* | ||
| - `SendResult`, `UploadResponse` | ||
| - `CreateGroupResult` | ||
| - `CreateCommunityResult`, `CommunitySubgroup`, `LinkSubgroupsResult`, `UnlinkSubgroupsResult` | ||
|
|
||
| **What changes:** External crates can no longer construct these types via struct-literal syntax or match them exhaustively without a `..` wildcard. Field reads are unaffected. | ||
|
|
||
| **In practice:** The library constructs all of these — consumers only receive them. The PR confirmed zero struct-literal constructions outside the defining crate, so the attribute enforces the already-intended API contract. | ||
|
|
||
| **Migration:** Add `..` to any exhaustive struct destructuring patterns: | ||
|
|
||
| ```rust | ||
| // Before (fails to compile outside the crate): | ||
| let SendResult { message_id, to } = result; | ||
|
|
||
| // After: | ||
| let SendResult { message_id, to, .. } = result; | ||
| ``` |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fresh evidence: after construction guidance was added elsewhere, this added note still says the only external impact is exhaustive destructuring, but Rust also rejects struct-literal construction of a
#[non_exhaustive]struct outside its defining crate. Consumers who fabricateSendResultin tests or adapters will follow incomplete migration guidance; the same wording appears on the newly addedCreateGroupResult,ParticipantChangeResponse, andUploadResponsenotes and should include construction or avoid saying “only”.Useful? React with 👍 / 👎.