Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

Conversation

@titaniumtraveler
Copy link

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.rs specifically the AsyncNotifierTyped trait.

That is then used to "override" the methods async methods (with a mean little Deref trick) 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.

@titaniumtraveler titaniumtraveler marked this pull request as draft March 18, 2025 05:06
@jamesmunns
Copy link
Owner

Noting that some changes from this PR were merged here: #3, and that we probably could have unsafe fns on the bbqhandle that gives access to the storage/coord/notifier items as a more limited change.

@jamesmunns
Copy link
Owner

@titaniumtraveler I'm going to close this, as I am moving things over to the bbqueue repo. Feel free to ping me on chat if you want to figure out how to get this updated and upstreamed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants