Streaming/Lazy/No-copy scanner.
I tried FallibleStreamingIterator but failed due to some errors reported by the borrow checker.
But our Scanner
is a FallibleStreamingIterator
:
FallibleStreamingIterator
differs from the standard library'sIterator
trait in two ways: iteration can fail, resulting in an error, and only one element of the iteration is available at any time. While these iterators cannot be used with Rustfor
loops,while let
loops offer a similar level of ergonomics.
Currently, there are one unsafe
block in the scan
method used to bypass the borrow checker.
I don't know if it can be replaced with safe code.
But I am quite confident that it is safe.
Two concrete scanners are implemented: