ehttpd 0.14.0

A HTTP server nano-framework, which can be used to create custom small-scale HTTP server applications
Documentation
use ehttpd::bytes::Source;
use std::io::Read;

#[test]
fn bytes_read_is_tracked() {
    // A source with unread data
    let mut source = Source::from(b"hello");

    // Ensure that no bytes have been read initially
    assert_eq!(source.bytes_read(), 0);

    // Read the first part and ensure that it is counted
    let mut prefix = [0; 2];
    source.read_exact(&mut prefix).expect("failed to read source prefix");
    assert_eq!(prefix, *b"he");
    assert_eq!(source.bytes_read(), 2);

    // Read the remaining data and ensure that the total is counted
    let mut suffix = Vec::new();
    source.read_to_end(&mut suffix).expect("failed to read source suffix");
    assert_eq!(suffix, b"llo");
    assert_eq!(source.bytes_read(), 5);
}