checkpipe
A rust library for computing things about bytes as they flow through pipelines.
The motivating use case is performing a checksum on all bytes passing through a reader or writer.
Example
use ;
use ;
use ;
const DATA: = *b"Hello, world!";
const PATH: &'static str = "foo.txt";
Implementing your own checks
Implement the Check
trait on a struct, which provides methods for taking a chunk of bytes,
and eventually returning the result of its computation.
Then wrap that struct and some struct through which bytes pass in a Checker
.
Check
is already implemented for all types implementing Hasher
,
and there are some convenience methods in place if you want to use rust's default hasher.
If the wrapped type in Checker
is Read
or Write
, so too will the Checker
.