Require `&mut self` for stream state controls

Open
#1,377 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

Read the stream control APIs for .start(), .pause(), and .stop(), along with .buffer_size() and .now() to see how their receivers and thread-safety bounds are defined. The issue proposes requiring &mut self for the three controls while leaving the other methods and Send + Sync bound unchanged; done means the API expresses that distinction consistently.

Written by the indexing model from the issue text.

Description

API design

Allowing .start() / .pause() / .stop() to be called simultaneously by different threads seems like an anti-pattern, as it inevitably requires synchronization under the hood. .buffer_size() and .now() should be fine to stay as they are.

Note that this is does not affect the Send + Sync bound

Dominant language
Rust
Stars
4k
Forks
554
Avg merge
1d 3h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RustAudio/cpal

All issues in RustAudio/cpal

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.