Skip to content

pw: Stream: Split Stream into owning Stream and nonowning StreamRef, add Drop for Stream

Tom Wagner requested to merge ryuukyu/pipewire-rs:stream-split into main

To be able to add a Drop impl to the Stream that only runs once, this commit splits Stream into a owing Stream struct that can only exist once per stream, and a nonowning &StreamRef wrapper which can exist multiple times.

The Stream gets a Deref impl to the StreamRef wrapper, and all methods of the stream exluding memory-management (new, into_raw) are moved to StreamRef.

This allows us to add the Drop impl to the Stream type to ensure the raw stream is destroyed without it being called multiple times, and without big changes to users of the crate.

Fixes #53 (closed)

Edited by Tom Wagner

Merge request reports