bytes icon indicating copy to clipboard operation
bytes copied to clipboard

Add SeekBuf trait and BufCursor implementation

Open dylanplecki opened this issue 7 months ago • 2 comments

Fixes #657.

This PR introduces the SeekBuf trait for buffers that support arbitrary lookups of memory, and a new BufCursor struct for immutably iterating over a SeekBuf type.

SeekBuf is strictly an opt-in trait with additional functionality over the standard Buf trait and otherwise does not change the API of this crate.

The BufCursor type provides compatibility to a wide range of core/std Rust features through its Iterator implementation. It also allows recursive and non-consuming access to the full memory of a buffer that was otherwise not possible via the Buf trait.

dylanplecki avatar Jan 19 '24 21:01 dylanplecki