I'm trying to simulate the behavior of this C code in Rust:
len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
in_data, in_len,
pts, dts, pos);
in_data += len;
in_data
is a buffer. It can be advanced.
How can I do something similar with a slice? I know I can take a subslice, and I could even write a class that I can advance and then return a subslice.
But is there something in the default libraries that already does that? Something like a buffered slice reader? PS: one that does not copy again the slice, only owns it and returns subslices according to the +=
operator on it.
in_data = &in_data[len..];
.&[u8]
implementsstd::io::Read
, although this only works for byte slices.