Skip to content

Conversation

@kixelated
Copy link
Collaborator

The Produce<P, C> struct was a named tuple for bundling producer/consumer pairs. This removes it and changes the API pattern:

  • X::produce() now returns just the producer (e.g., BroadcastProducer)
  • Call .consume() on the producer to get a consumer when needed

This simplifies the API and makes ownership clearer.

The `Produce<P, C>` struct was a named tuple for bundling producer/consumer
pairs. This removes it and changes the API pattern:

- `X::produce()` now returns just the producer (e.g., `BroadcastProducer`)
- Call `.consume()` on the producer to get a consumer when needed

This simplifies the API and makes ownership clearer.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kixelated kixelated enabled auto-merge (squash) January 28, 2026 17:56
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Walkthrough

This pull request refactors the producer-consumer API design across the moq-lite codebase. The main change removes the Produce<P, C> wrapper type that previously bundled producer and consumer fields together. Instead, produce() methods now return a producer directly, with a new consume() method on producers providing access to the corresponding consumer. Direct methods are added to Origin and Broadcast types (e.g., publish_broadcast(), create_track()) that were previously accessed through nested .producer fields. All call sites throughout the codebase are updated to use the new API patterns, including client code, importers, and relay implementations.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 78.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: removing the Produce struct and simplifying the API pattern from returning producer/consumer pairs to returning only producers.
Description check ✅ Passed The PR description clearly explains the changes: removal of Produce struct, API pattern shift to returning only producers, and introduction of .consume() method on producers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kixelated kixelated merged commit c7f47ff into main Jan 28, 2026
1 check passed
@kixelated kixelated deleted the remove-produce-struct branch January 28, 2026 18:01
@moq-bot moq-bot bot mentioned this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants