stream: stream_sv and stream_sv_abs

Just straight string views into the current stream content - obviously
may not be stable.  Helpful when analysing a non-moving stream.
This commit is contained in:
2026-02-06 07:05:10 +00:00
committed by oreodave
parent a6d3d861b7
commit 477abc9aa1
2 changed files with 34 additions and 15 deletions

View File

@@ -70,6 +70,12 @@ u64 stream_seek(stream_t *, i64);
u64 stream_seek_forward(stream_t *, u64);
u64 stream_seek_backward(stream_t *, u64);
// Return a string view to stream data relative to the current position of the
// stream
sv_t stream_sv(stream_t *);
// Return a string view to data from the start of the stream
sv_t stream_sv_abs(stream_t *);
// Return a relative substring of a given size
sv_t stream_substr(stream_t *, u64);
// Return an absolute substring at given index and of given size.