Skip to content

spa: pod: Add `Pod` wrapper around spa_sys::spa_pod

Tom Wagner requested to merge ryuukyu/pipewire-rs:spa-pod-wrapper into main

The new struct spa::pod::Pod is a transparent wrapper around the raw type and guarantees (through unsafe constructor/cast methods) that borrows point at a valid pod and Rusts "one mutable borrow XOR multiple nonmutable borrows" rule is respected.

This also adds is_* methods to the struct which are bindings to spa_pod_is_* functions.

We can use this in other methods that currently take a *[const|mut] spa_sys::spa_pod and potentially make them not unsafe because the argument is guaranteed to point to a valid pod.

And more methods from https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/include/spa/pod/iter.h can be added in the future to allow the user to perform actions directly on pods.

Merge request reports