0
Since last time, I’ve improved the API a bit. That last post
was about API version 0.3. Now it’s on 0.4, and I think it’s getting
pretty decent.
0.3 could never have worked very well. The API was VecDeque
-based,
which means it could not provide a linear view (a slice) of all the
data in the buffer.
The 0.4 API is simpler. You get a typed slice, and you read or write
to, it as appropriate. Because all streams are currently single
writer, single reader, the code is simple, and requires minimal amount
of locking.
It’s simpler, but I switched to using memory mapped circular buffers,
with a slice as the stream interface. This means that the buffer is
allocated only once, yet both reader and writer can use all space
available to them, linearly, without having to worry about wrapping
around.
The code is still at https://github.com/ThomasHabets/rustradio. I
registered the github org rustyradio
, too. rustradio
was taken. I
sent a message to the owner, since it seems to not have any real
content, but have not heard back.
Unsafe code
To make this multiuser stream I did have to write some Continue reading