Skip to content

Conversation

@mcmah309
Copy link
Contributor

@mcmah309 mcmah309 commented Dec 12, 2025

There currently is no ergonomic way to await Resources in an async closure. This PR adds the read_async method to Resource

@mcmah309 mcmah309 requested a review from a team as a code owner December 12, 2025 09:26
@ealmloff ealmloff added breaking This is a breaking change hooks Changes to built-in hook package labels Dec 29, 2025
// Can await the waker to be woken.
// We use `.peek()` here to avoid reacting to changes in the underlying task_rx which could lead
// to an effect/future loop.
impl<T: Clone + 'static> std::future::Future for UseWaker<T> {
Copy link
Member

Choose a reason for hiding this comment

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

This makes the change breaking. Could you restore this and mark it as deprecated so we can remove it in the next major release? We may need to remove IntoFuture

Copy link
Contributor Author

@mcmah309 mcmah309 Dec 30, 2025

Choose a reason for hiding this comment

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

Unless I am missing something, if we restore this, then we have to remove IntoFuture. If we remove IntoFuture then the bug in the future implementation for UseWaker remains. If this is considered a breaking change, then removing Future directly on Resource should also be considered a breaking change?

It may come down to this being an acceptable "breaking change". The only code this would break is if someone did something like let x: UseWaker = use_waker.into_future(); (now needs to be let x: UseWakerFuture = use_waker.into_future();), which I imagine never happens in practice. Code like use_waker.await or resource.await is unaffected. I know libraries like tokio have done these type of breaking changes in the past, I think this may be one of those cases we don't have to be religious about semver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking This is a breaking change hooks Changes to built-in hook package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants