Skip to content

pw: loop: Replace `IsLoop` trait with `AsRef<LoopRef>` and `Deref` implementations, make `Loop` refcounted.

Tom Wagner requested to merge ryuukyu/pipewire-rs:fix-loop-non-clone into main

The trait IsLoop was defined exactly like AsRef<LoopRef> is, and did exactyl what AsRef does: Convert a reference to an owned type to a reference type.

Therefore we can just implement the AsRef trait instead.

The commit also makes the Loop trait refcounted. The pipewire C lib does not refcount these types, but we rust bindings require refcounting for its safe interface.

The Loop struct not being refcounted meant that it could not be used with the Context struct, which was an oversight in its initial implementation, so this commit also fixes that.

Merge request reports