edf_reader/
file_reader.rs

1//! Contains traits/implementations for reading a file in a sync or async manner.
2
3use futures::Future;
4
5/**
6 * An synchronous file reader
7 */
8pub trait SyncFileReader {
9    fn read(&self, offset: u64, length: u64) -> Result<Vec<u8>, std::io::Error>;
10}
11
12/**
13 * An asynchronous file reader (returns futures)
14 */
15pub trait AsyncFileReader {
16    fn read_async(
17        &self,
18        offset: u64,
19        length: u64,
20    ) -> Box<Future<Item = Vec<u8>, Error = std::io::Error> + Send>;
21}