Closed mkeeter closed 1 year ago
Update: I removed SliceBufReader/Writer
in favor of implementing BufReader/Writer
directly on slices (after some help from John and Rain in fighting variance).
FWIW, LeaseBufWriter
only has a one-byte read operation simply because that's what I needed at the time -- adding one that copies out N bytes into a slice or equivalent, or an iterator as @andrewjstone suggested, would be more efficient if you need that sort of thing.
Thanks! I think I'll leave the one-byte-at-a-time functions for now, since that's what I need, but this should be easy to revisit later.
This is a pre-requisite for letting Hubris code be generic across slices and leases.
I added a new
BufReader
trait, which is implemented for both the existingLeaseBufReader
and a newSliceBufReader
; the same goes forBufWriter
/SliceBufWriter
.This allows us to write code of the form