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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#[cfg(feature = "async")]
mod r#async;
mod reader;
mod record;
mod writer;
pub use self::{reader::Reader, record::Record, writer::Writer};
#[cfg(feature = "async")]
pub use self::r#async::Reader as AsyncReader;
use std::{
fs::File,
io::{self, BufReader},
path::Path,
};
pub type Index = Vec<Record>;
pub fn read<P>(src: P) -> io::Result<Index>
where
P: AsRef<Path>,
{
let mut reader = File::open(src).map(BufReader::new).map(Reader::new)?;
reader.read_index()
}