use std.Io.Writer #26

Merged
geemili merged 0 commits from refs/pull/26/head into dev 2025-09-05 22:58:28 +00:00
geemili commented 2025-09-05 19:43:01 +00:00 (Migrated from codeberg.org)

Follow up to pull request #24 where I changed pulsar to use std.Io.Reader.

Follow up to pull request #24 where I changed pulsar to use std.Io.Reader.
geemili commented 2025-09-05 22:01:19 +00:00 (Migrated from codeberg.org)

@desttinghim wrote in https://codeberg.org/klaji/pulsar/pulls/26#issuecomment-6953090:

Looks good for the most part! This does regress the behavior of the tagstruct functions in a subtle way - they might write data when there isn't room for the complete value to be written. I don't know how useful that property is in practice, since we don't have any other code handling incomplete writes. Should we guarantee that the tagstruct functions will only perform complete writes?

I don't think the tagstruct functions need to guarantee that it only does complete writes, as that is more easily done somewhere higher up the chain. In src/pulseaudio.zig in the beginControlPacket function, for example, I create fixed buffer writer, which will return error.WriteFailed if the buffer is full. I would argue that it makes more sense in the pulseaudio implementation, which requires a length prefix, and thus must buffer or pre-calculate the length; whereas nothing in the tagstruct format actually dictates buffering.

@desttinghim wrote in https://codeberg.org/klaji/pulsar/pulls/26#issuecomment-6953090: > Looks good for the most part! This does regress the behavior of the tagstruct functions in a subtle way - they might write data when there isn't room for the complete value to be written. I don't know how useful that property is in practice, since we don't have any other code handling incomplete writes. Should we guarantee that the tagstruct functions will only perform complete writes? I don't think the tagstruct functions need to guarantee that it only does complete writes, as that is more easily done somewhere higher up the chain. In `src/pulseaudio.zig` in the `beginControlPacket` function, for example, I create fixed buffer writer, which will return `error.WriteFailed` if the buffer is full. I would argue that it makes more sense in the pulseaudio implementation, which requires a length prefix, and thus must buffer or pre-calculate the length; whereas nothing in the `tagstruct` format actually dictates buffering.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
klaji/pulsar!26
No description provided.