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

Open
costajohnt wants to merge 2 commits intoDioxusLabs:mainfrom
costajohnt:feat/writable-result-ext
Open

feat(signals): add WritableResultExt trait#5338
costajohnt wants to merge 2 commits intoDioxusLabs:mainfrom
costajohnt:feat/writable-result-ext

Conversation

Copy link

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
...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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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?

1 participant