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

feat: subscription type #175

Merged
merged 9 commits into from
Feb 1, 2024
Merged

feat: subscription type #175

merged 9 commits into from
Feb 1, 2024

Conversation

prestwich
Copy link
Member

@prestwich prestwich commented Feb 1, 2024

Adds the following types:

  • RawSubscription
  • SubscriptionItem<T>
  • Subscription<T>

Motivation

Lay groundwork for RAII subscriptions and subscription configuration.

Solution

Add Subscription type around the raw tokio::broadcast::Receiver

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@prestwich prestwich added enhancement New feature or request debt Tech debt which needs to be addressed labels Feb 1, 2024
@prestwich prestwich self-assigned this Feb 1, 2024
crates/pubsub/src/sub.rs Show resolved Hide resolved
crates/pubsub/src/sub.rs Outdated Show resolved Hide resolved
@mattsse
Copy link
Member

mattsse commented Feb 1, 2024

separately, sooner or later we want a stream type:

https://docs.rs/tokio-stream/latest/tokio_stream/wrappers/struct.BroadcastStream.html

@prestwich
Copy link
Member Author

separately, sooner or later we want a stream type

yeah, I was considering implementing these as streams, but there's an upcoming conflict between Unpin/projection and Drop impl for RAII guards I think?

@prestwich
Copy link
Member Author

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

all of these make sense to me.

having a new type is better than dealing with receiver, so we can add functions as we like

@prestwich prestwich merged commit 2d23d57 into main Feb 1, 2024
14 checks passed
@prestwich prestwich deleted the prestwich/subscription-types branch February 1, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Tech debt which needs to be addressed enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants