pub async fn load_file_async<'a, P>(
    file: P,
    config: RecordIndexerConfig,
) -> Result<impl Stream<Item = Result<RecordIndex>>>
where
    P: Into<Cow<'a, std::path::Path>>,
{
    let file = file.into().into_owned();
    let reader = BufReader::new(File::open(&file).await?);

    let file = Arc::new(std::path::PathBuf::from(file.into_os_string()));
    let stream = load_reader_async(reader, config).map(move |pos| {
        let Position { offset, len } = pos?;
        Ok(RecordIndex {
            path: file.clone(),
            offset,
            len,
        })
    });
    Ok(stream)
}
/// Load record indexes from a file.
Load record indexes from a file.
Load record indexes from a file .
pub async fn load_file_async<'a, P>(
    file: P,
    config: RecordIndexerConfig,
) -> Result<impl Stream<Item = Result<RecordIndex>>>
where
    P: Into<Cow<'a, std::path::Path>>,
{
    let file = file.into().into_owned();
    let reader = BufReader::new(File::open(&file).await?);
    let file = Arc::new(std::path::PathBuf::from(file.into_os_string()));
    let stream = load_reader_async(reader, config).map(move |pos| {
        let Position { offset, len } = pos?;
        Ok(RecordIndex {
            path: file.clone(),
            offset,
            len,
        })
    });
    Ok(stream)
}
pub async fn load_file_async < ' a , P > ( file : P , config : RecordIndexerConfig , ) -> Result < impl Stream < Item = Result < RecordIndex > > > where P : Into < Cow < ' a , std :: path :: Path > > , { let file = file . into ( ) . into_owned ( ) ; let reader = BufReader :: new ( File :: open ( & file ) . await ? ) ; let file = Arc :: new ( std :: path :: PathBuf :: from ( file . into_os_string ( ) ) ) ; let stream = load_reader_async ( reader , config ) . map ( move | pos | { let Position { offset , len } = pos ? ; Ok ( RecordIndex { path : file . clone ( ) , offset , len , } ) } ) ; Ok ( stream ) }
Load record indexes from a file.
Load record indexes from a file .
file
P
config
RecordIndexerConfig
file
P
config
RecordIndexerConfig