Open udoprog opened 1 year ago
Note that wrap
could still be used by downstreams to wrap plain slices into interleaved or planar slices since these need to be provided a channel length. This would only really serve to get rid of wrap::Dynamic
.
This would only really serve to get rid of wrap::Dynamic.
That would be nice. However, if we decide to make a uniform channel length an invariant of the Buf trait (#30), implementing Buf/BufMut directly on standard library types would remove the opportunity to check that when constructing a wrapper.
Would it? Such a wrapper could implement ExactSizeBuf
.
Two libraries I'm using quite frequently are
bstr
, andbytes
(who's naming convention is borrowed here), and one of their decisions is to implement an [extension trait directly on types instead of solely requiring a wrapper like thewrap
module:bstr
documentation.bytes
documentation.This is an option worth exploring for the
audio
crate, and maybe one to seriously consider. Because it would preempt questions such as the need to export thewrap
module from crates, making it easier to use primitive Rust types directly meaning users might not even need to depend on theaudio
crate to use the library. Unless they have a specific reason like usingaudio
crate-specific buffers.CC: @Be-ing