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

A consistent way to cancel subscriptions from within the subscription #673

Closed
philpax opened this issue Aug 10, 2023 · 0 comments
Closed
Assignees
Labels
enhancement New feature or request topic:api API functionality, including both host and guest
Milestone

Comments

@philpax
Copy link
Contributor

philpax commented Aug 10, 2023

At present, it is very difficult to do one-shot / conditionally-active subscriptions, because you can't refer to the return value of a subscriber from within the closure:

let listener = Frame::subscribe(|_| {
  listener.stop(); // this will not work
});

An idea is to add a Context parameter that includes the message's source and to provide a stop method. We want to avoid using the return value as that may be used for some other form of semantics (i.e. #253 or early-exiting a chain of handlers).

@philpax philpax added enhancement New feature or request topic:api API functionality, including both host and guest labels Aug 10, 2023
@philpax philpax added this to the 0.3 milestone Aug 31, 2023
@philpax philpax self-assigned this Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic:api API functionality, including both host and guest
Projects
None yet
Development

No branches or pull requests

1 participant