This repository was archived by the owner on Jan 4, 2026. It is now read-only.
Give type access to manually implemented notifier futures #2
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.
For a project I'm working on I needed a custom notifier with the specialty that the awoken futures also need to control how and when they get polled again, which means they need to have some way to get a handle to the notifier.
The obvious way to do give them that access was over the future that it returns. The only problem with that was that because of the async traits, all I get are opaque
impl Future<Output = T>types.My solution to that was to add an Interface that has you manually declare the concrete future types. See
src/traits/notifier/typed.rsspecifically theAsyncNotifierTypedtrait.That is then used to "override" the methods async methods (with a mean little
Dereftrick) to return the concrete notifier futures.I'm not sure if this code is useful for you, but I would have felt weird not to at least offer it.