1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
mod read;
mod traits;

pub use traits::*;

use pin_project_lite::pin_project;

pin_project! {
    /// An `AsyncRead`er which applies a timeout to read operations.
    #[derive(Debug)]
    pub struct CacheReader<R> {
        #[pin]
        pub(crate) reader: R,
        #[pin]
        pub(crate) cache: Vec<u8>
    }
}

impl<R> CacheReader<R> {
    pub fn new(reader: R) -> CacheReader<R> {
        CacheReader {
            reader,
            cache: Vec::new(),
        }
    }
}