Bytes ArrayBuffer or DataView
jamesdbrock opened this issue · comments
James Brock commented
the type of Bytes
should be:
-- | The constructors are functionally interchangeable, except we usually use `BytesBuffer` when writing protobuf and
-- | `BytesView` when reading protobuf, so that when reading we don't have to make copies of slices of the ArrayBuffer.
data Bytes
= BytesBuffer ArrayBuffer
| BytesView DataView
-- | Read `Bytes` as a `DataView`.
viewBytes :: Bytes -> DataView
viewBytes (BytesBuffer ab) = whole ab
viewBytes (BytesView dv) = dv
James Brock commented
Now we have the Bytes
type in arraybuffer-builder that we can use for this.
Hm should that type be exported outside the Internal
module?
James Brock commented
Done in v2.0.0