[pulseaudio-discuss] [announce] Rust bindings!

David Henningsson diwic at ubuntu.com
Wed Jun 13 19:42:05 UTC 2018



On 2018-06-13 09:29, Tanu Kaskinen wrote:
> On Tue, 2018-06-12 at 19:03 +0100, jnqnfe at gmail.com wrote:
>> On Tue, 2018-06-12 at 11:22 +0300, Tanu Kaskinen wrote:
>>> On Mon, 2018-05-28 at 19:37 +0100, jnqnfe at gmail.com wrote:
>>>> Hi everyone!
>>>>
>>>> Back in February I released 'binding' and 'sys' crates for using
>>>> pulseaudio from Rust code. I had intended to make an announcement
>>>> here
>>>> at the time, but I failed to do so, so I'm doing it now.
>>>>
>>>> fyi, the 'sys' crates provide a simple description of the C
>>>> interface;
>>>> The 'binding' crates take this further, providing a cleaner/safer
>>>> Rust
>>>> interface.
>>>>
>>>> I have provided separate crates for each PA system library (per
>>>> Rust
>>>> guidelines for 'sys' crates), thus totalling six in all:
>>>>
>>>> [binding crates]
>>>>   - libpulse-binding: https://crates.io/crates/libpulse-binding
>>>>   - libpulse-simple-binding: https://crates.io/crates/libpulse-simpl
>>>> e-bi
>>>> nding
>>>>   - libpulse-mainloop-glib-binding: https://crates.io/crates/libpuls
>>>> e-gl
>>>> ib-binding
>>>> [sys crates]
>>>>   - libpulse-sys: https://crates.io/crates/libpulse-sys
>>>>   - libpulse-simple-sys: https://crates.io/crates/libpulse-simple-sy
>>>> s
>>>>   - libpulse-mainloop-glib-sys: https://crates.io/crates/libpulse-ma
>>>> inlo
>>>> op-glib-sys
>>>>
>>>> The 'binding' crates include plenty of documentation (taken from
>>>> the C
>>>> API). This can be built locally of course (cargo doc), but is also
>>>> available online at docs.rs, example: https://docs.rs/libpulse-bind
>>>> ing/
>>>>
>>>> Long term I hope that the owners of the PA project itself would
>>>> like to
>>>> take over ownership and maintenance. Even longer term hopefully we
>>>> will
>>>> see PA itself converting to Rust - fyi the PA projects has my full
>>>> consent to use this work of mine in converting PA itself.
>>> Cool, thanks for the bindings! I'm afraid you'll have to keep
>>> maintaining the bindings yourself for the foreseeable future - I
>>> don't
>>> really want to take more work for myself at this point (I can of
>>> course
>>> only talk only for myself, but I don't expect the other maintainers
>>> to
>>> be enthusiastically adopting the bindings either). That said,
>>> converting PA to Rust might very well be a good idea. From what I've
>>> heard about combining Rust with C, such conversion could be done
>>> gradually.
>> Ok no problem :)
>>
>> I am very glad to hear that you are open to a Rust conversion. I'm very
>> busy at the moment, but I have given a little thought to it over the
>> past few days; perhaps I will try to tackle it at some point.
> No hurry :) Note that I can't alone make the decision to start
> converting to Rust. Not everyone might have as good perception of the
> language as me (and that perception isn't based on actually trying to
> use the language), and not everyone might want to learn it. Arun and
> Georg, how do you feel about the prospect of gradually converting the
> codebase to Rust some day?

If I had the time and engagement to start working on a new sound server 
tomorrow, I would write it in Rust.
But just porting PulseAudio to Rust without solving any issues with 
PulseAudio's existing design, does not seem like the best use of time to me.

But should you make the step over to Rust, you're more than welcome to 
use my dbus and alsa bindings :-)

// David



More information about the pulseaudio-discuss mailing list