moq-net: accept impl Into<Option<Subscription>> for subscribe, drop subscribe_default#1606
Merged
Merged
Conversation
… subscribe_default `TrackProducer::subscribe` and `TrackConsumer::subscribe` now take `impl Into<Option<Subscription>>`, so callers pass `None` for default preferences instead of `Subscription::default()`. The conversion happens once at the public boundary via `.into().unwrap_or_default()`; internal helpers keep taking a concrete `Subscription`. This makes the dedicated `subscribe_default()` convenience method redundant, so it's removed (along with a local test helper of the same name in moq-mux) in favor of `subscribe(None)`. All call sites across the workspace updated accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kixelated
enabled auto-merge (squash)
June 3, 2026 03:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes subscribing ergonomic when you just want the defaults: pass
Noneinstead ofSubscription::default().TrackProducer::subscribeandTrackConsumer::subscribenow takeimpl Into<Option<Subscription>>, converting once at the public boundary via.into().unwrap_or_default(). This matches the existingimpl Into<Option<T>>convention in the codebase (e.g.with_group_start,end_at). Internal helpers (request_subscribe,TrackWeak::subscribe) keep taking a concreteSubscription.subscribe_default()method (and a same-named local test helper in moq-mux) in favor ofsubscribe(None)..subscribe(Subscription::default())and.subscribe_default()→.subscribe(None).Call sites that build a customized subscription (
Subscription { .. }orSubscription::default().with_priority(1)) are untouched and still work, sinceSubscriptionitself satisfiesInto<Option<Subscription>>.Why
devRemoving
subscribe_defaultis a breaking change to the publicrs/moq-netAPI, so this targetsdevper the branch-targeting rules.Cross-package sync
No JS/doc changes needed: the
js/netAPI issubscribe(name, priority)with noSubscriptionstruct equivalent, and this is a Rust-only ergonomic change, not a wire or semantic change.Test plan
cargo check --workspace --testsclean (no warnings)cargo test -p moq-net -p moq-muxpasscargo fmt --checkclean (via nix)(Written by Claude)