Skip to content

Add with_origin convenience method to Client and Server#1153

Merged
kixelated merged 1 commit intomainfrom
claude/add-with-origin-builder-CNtpv
Mar 23, 2026
Merged

Add with_origin convenience method to Client and Server#1153
kixelated merged 1 commit intomainfrom
claude/add-with-origin-builder-CNtpv

Conversation

@kixelated
Copy link
Collaborator

Summary

Added a new with_origin() convenience method to both Client and Server that simplifies the common pattern of setting both publish and consume from an OriginProducer.

Key Changes

  • Added with_origin() method to Client that accepts an OriginProducer and configures both publish and consume in a single call
  • Added identical with_origin() method to Server for consistency
  • Both implementations extract the consumer from the origin producer and chain the existing with_publish() and with_consume() methods

Implementation Details

The with_origin() method is a convenience wrapper that:

  1. Calls origin.consume() to extract the consumer
  2. Chains with_publish(consumer) and with_consume(origin) to configure both directions

This eliminates the need for callers to manually extract the consumer and make two separate method calls, improving API ergonomics.

https://claude.ai/code/session_01BR7nZNehx4JkvZrKfaiaAt

Combines with_publish and with_consume into a single call by
accepting an OriginProducer and deriving the OriginConsumer via
origin.consume().

https://claude.ai/code/session_01BR7nZNehx4JkvZrKfaiaAt
@kixelated kixelated enabled auto-merge (squash) March 23, 2026 22:30
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 76aed695-90bf-41b5-8f90-b04f55c5dcfc

📥 Commits

Reviewing files that changed from the base of the PR and between ebb43e9 and c5423f0.

📒 Files selected for processing (2)
  • rs/moq-lite/src/client.rs
  • rs/moq-lite/src/server.rs

Walkthrough

The pull request adds a new with_origin builder method to both the Client and Server types in the moq-lite library. This method accepts an OriginProducer parameter, derives a consumer endpoint from it, and configures the client or server's publish and consume endpoints. The same pattern is applied to both types.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a with_origin convenience method to Client and Server classes.
Description check ✅ Passed The description is well-structured and directly related to the changeset, providing clear context about the new with_origin method and its purpose.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/add-with-origin-builder-CNtpv
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/add-with-origin-builder-CNtpv

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 69d8ff9 into main Mar 23, 2026
2 checks passed
@kixelated kixelated deleted the claude/add-with-origin-builder-CNtpv branch March 23, 2026 22:54
This was referenced Mar 23, 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