Skip to content

Create transparent `DictRef` wrapper around spa_dict, remove dict traits

Tom Wagner requested to merge ryuukyu/pipewire-rs:dict-ref into main

This applies the ref-struct pattern that we use in the project to spa_dict by creating a new DictRef wrapper, which provides the same functionality that the old ReadableDict trait used to.

The contents of the WritableDict trait are moved into the data structures that implement a spa_dict, so into pw::properties::Properties, which is also how it works in the pipewire C library.

The dict can be obtained from a pw::properties::Properties (and its ref struct) through AsRef<&spa::utils::dict::Dict> implementations.

TODO:

  • Add dict() method to pw::properties::PropertiesRef to obtain the dict, which is easier to use than the generic AsRef trait.
  • Add Clone/ToOwned methods where appropriate to clone something that contains a borrowed dict.
Edited by Tom Wagner

Merge request reports