-
Hello, I'm having a hard time figuring out how to jump to the beginning of the stream. It's easy to do with a My stream would look like this (I need location tracking): pub(crate) type Input<'a> = Stateful<Located<&'a [u8]>, State<'a>>;
pub(crate) struct State<'a> {
pub start: Option<Checkpoint<Checkpoint<Checkpoint<&'a [u8], &'a [u8]>, Located<&'a [u8]>>, Stateful<Located<&'a [u8]>, State<'_>>>>
} Is this the only way? Am I missing something obvious? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is not a built-in way of doing this. I've not seen this yet in another parsing library and don't have any use cases for it myself. To evaluate whether this is worth supporting natively, we'd need to better understand the use case. Technically, it wouldn't be too hard for a Another good way to evaluate whether to support this natively is to provide it in a third-party solution and see what the adoption looks like. There is nothing special to the design of custom stream types; they can be implemented outside of |
Beta Was this translation helpful? Give feedback.
Oh interesting! I wonder how other higher level parsers (ie not using
fseek
) deal with this.For now, I've added
Located::reset_to_start
in #595 which is available in 0.6.19