Skip to content

moq-net: accept impl Into<Option<Subscription>> for subscribe, drop subscribe_default#1606

Merged
kixelated merged 1 commit into
devfrom
claude/cranky-hermann-61d9db
Jun 3, 2026
Merged

moq-net: accept impl Into<Option<Subscription>> for subscribe, drop subscribe_default#1606
kixelated merged 1 commit into
devfrom
claude/cranky-hermann-61d9db

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

Makes subscribing ergonomic when you just want the defaults: pass None instead of Subscription::default().

  • TrackProducer::subscribe and TrackConsumer::subscribe now take impl Into<Option<Subscription>>, converting once at the public boundary via .into().unwrap_or_default(). This matches the existing impl Into<Option<T>> convention in the codebase (e.g. with_group_start, end_at). Internal helpers (request_subscribe, TrackWeak::subscribe) keep taking a concrete Subscription.
  • Removed the now-redundant subscribe_default() method (and a same-named local test helper in moq-mux) in favor of subscribe(None).
  • Updated every call site across the workspace: .subscribe(Subscription::default()) and .subscribe_default().subscribe(None).

Call sites that build a customized subscription (Subscription { .. } or Subscription::default().with_priority(1)) are untouched and still work, since Subscription itself satisfies Into<Option<Subscription>>.

Why dev

Removing subscribe_default is a breaking change to the public rs/moq-net API, so this targets dev per the branch-targeting rules.

Cross-package sync

No JS/doc changes needed: the js/net API is subscribe(name, priority) with no Subscription struct equivalent, and this is a Rust-only ergonomic change, not a wire or semantic change.

Test plan

  • cargo check --workspace --tests clean (no warnings)
  • cargo test -p moq-net -p moq-mux pass
  • cargo fmt --check clean (via nix)

(Written by Claude)

… 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
kixelated enabled auto-merge (squash) June 3, 2026 03:08
@kixelated
kixelated merged commit e453634 into dev Jun 3, 2026
2 checks passed
@kixelated
kixelated deleted the claude/cranky-hermann-61d9db branch June 3, 2026 03:33
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.

1 participant