Closed phiryll closed 2 weeks ago
If it turns out that the I/O methods almost always delegate to []byte ones, then consider removing them entirely and provide some helper functions for that use case.
If the user is actually working with an I/O stream, nillable Codecs and those requiring a terminator are impossible without some additional code on the user's part.
Unless those are additional methods on those specific Codecs? For fixed-length Codecs, using Size() would be sufficient for a (non-member) helper function.
I think lexy is going to abandon the io.Reader/Writer API entirely. There will be a couple adapter functions, but that's it.
If I decide to not do this, this issue can be reopened.
Can MaxSize() just be Size()? No. The only point of MaxSize() is so the user can preallocate a buffer to use for Put(buf, value).
Can RequiresTerminator() simply be size < 0? Exceptions:
wrt the general task, whichever way makes more sense or is more performant (benchmark!).