Skip to content
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

Add a way to peek signals without panicking #2612

Closed
alex5nader opened this issue Jul 9, 2024 · 0 comments · Fixed by #2714
Closed

Add a way to peek signals without panicking #2612

alex5nader opened this issue Jul 9, 2024 · 0 comments · Fixed by #2714
Assignees
Labels
enhancement New feature or request signals Related to the signals crate
Milestone

Comments

@alex5nader
Copy link

Feature Request

Right now, signals have two options for reading: read() and peek(). Both of these will panic if the signal's value has been dropped, but this can be prevented with try_read(). There is currently no way to do the same for peek().

Implement Suggestion

Add a way to peek signals without panicking if the underlying value has been dropped. Presumably this would live in the Readable trait with the other methods.

@ealmloff ealmloff added enhancement New feature or request signals Related to the signals crate labels Jul 9, 2024
@jkelleyrtp jkelleyrtp added this to the 0.6.0 milestone Jul 25, 2024
@jkelleyrtp jkelleyrtp self-assigned this Jul 26, 2024
jkelleyrtp added a commit that referenced this issue Jul 26, 2024
Our implementation for Readable was inconsistent.
We had a try_unchecked variant for read but not for peek.
This resolves that by making a breaking change to the
Readable interface.
jkelleyrtp added a commit that referenced this issue Jul 26, 2024
* Fix #2612: adjust readable trait to allow try_peek

Our implementation for Readable was inconsistent.
We had a try_unchecked variant for read but not for peek.
This resolves that by making a breaking change to the
Readable interface.

* fix doctests too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request signals Related to the signals crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants