Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(signals): add WritableResultExt trait#5338

Merged
ealmloff merged 3 commits intoDioxusLabs:mainfrom
costajohnt:feat/writable-result-ext
Mar 9, 2026
Merged

feat(signals): add WritableResultExt trait#5338
ealmloff merged 3 commits intoDioxusLabs:mainfrom
costajohnt:feat/writable-result-ext

Conversation

Copy link
Contributor

costajohnt commented Feb 28, 2026

Summary

Adds WritableResultExt trait for Writable>, mirroring the existing ReadableResultExt on the read side. This provides mutable access to signal values holding Result without needing an intermediate binding.

Methods

  • as_mut() -- returns Result, WritableRef>, giving mutable access to whichever variant the Result holds
  • unwrap_mut() -- returns WritableRef, panicking if the Result is Err

Pattern

Follows the same extension trait pattern used by WritableOptionExt and ReadableResultExt:

  • Blanket impl over all W: Writable>
  • Uses WriteLock::map / WriteLock::filter_map for mapped mutable references
  • #[track_caller] on all methods for better panic diagnostics

Closes #5293

Add WritableResultExt mirroring the existing ReadableResultExt,
providing mutable access to signal values holding Result.

Methods:
- as_mut(): returns Result, WritableRef>
- unwrap_mut(): returns WritableRef, panics if Err

Closes DioxusLabs#5293
costajohnt marked this pull request as ready for review February 28, 2026 17:32
costajohnt requested a review from a team as a code owner February 28, 2026 17:32
costajohnt and others added 2 commits February 28, 2026 10:21
...xt::as_mut

Replace bare .unwrap() calls with .expect() containing a descriptive
message about the failure mode. This gives better diagnostics if the
Result variant changes between the read and write lock acquisitions.
ealmloff reviewed Mar 9, 2026
ealmloff approved these changes Mar 9, 2026
Copy link
Member

ealmloff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, great to have this for writes!

ealmloff merged commit b7958d3 into DioxusLabs:main Mar 9, 2026
16 of 20 checks passed
costajohnt deleted the feat/writable-result-ext branch March 9, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

ealmloff ealmloff approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Feature Request] WriteableResultExt in addition to ReadableResultExt?

2 participants