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

Sources that are part of the Source trait should not have public factories. #622

Open
dvdsk opened this issue Sep 28, 2024 · 0 comments
Open
Labels
breaking Proposed change that would break the public API

Comments

@dvdsk
Copy link
Collaborator

dvdsk commented Sep 28, 2024

Clarifying example: source_instance.speed(1.5) wraps whatever source instance its called on in a Speed struct (which is itself again a Source). The Speed struct can also be constructed by using speed::speed::new(source_instance, 1.5)

The latter is clearly not meant to be used as the docs for such factories are often along the line of:

/// Internal function that builds a `Speed` object.

This specific example was made before pub(crate) existed (yeah rodio is 9 years old and still improving 🥳 ) see: https://releases.rs/docs/1.30.0/.

I propose that a source's factories are made private to the crate (pub(crate)) when the Source wraps an inner source.

This:

  • steers users in how to use Rodio
  • reduces the API surface, easing maintenance
  • removes the need for documentation

When implementing care should be taken to copy/merge the documentation to/with that on Source::.

@dvdsk dvdsk added the breaking Proposed change that would break the public API label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Proposed change that would break the public API
Projects
None yet
Development

No branches or pull requests

1 participant