peekread
This crate allows you to take an arbitrary Read stream and 'peek ahead'
into the stream without consuming the original stream. This is done through the
PeekRead trait which has the method peek. When this method is called it
returns a new PeekCursor object implementing Read, BufRead and Seek that
allows you to read from the stream without affecting the original stream.
The PeekRead trait is directly implemented on a select few types, but for most
you will have to wrap your type in a SeekPeekReader or BufPeekReader that
implements the peeking behavior using respectively seeking or buffering.
Please refer to the the documentation for more information.
The minimum required stable Rust version for peekread is 1.31.0. To start using
peekread add the following to your Cargo.toml:
[]
= "0.1"
Example
A short example:
use ;
let mut f = new;
// HTML is so permissive its parser never fails, so check for signature.
if f.starts_with else
License
peekread is released under the Zlib license, a permissive license. It is
OSI and FSF approved and GPL compatible.