async fn filter_files<P: AsRef<Path>>(
    root_path: P,
) -> Option<impl tokio::stream::Stream<Item = PathBuf>> {
    let readdir = match tokio::fs::read_dir(root_path.as_ref().join(PARCEL_DIR)).await {
        Ok(r) => r,
        Err(e) if e.kind() == std::io::ErrorKind::NotFound => return None,
        Err(e) => panic!("unable to read parcel directory: {:?}", e),
    };
    Some(
        readdir
            .map(|entry| entry.expect("Error while reading parcel directory").path())
            .filter(|p| p.extension().unwrap_or_default() == PARCEL_EXTENSION),
    )
}
/// Filters all items in a parcel directory that do not match the proper extensions. Returns None if
/// there isn't a parcel directory
Filters all items in a parcel directory that do not match the proper extensions. Returns None if
there isn't a parcel directory
Filters all items in a parcel directory that do not match the proper extensions . Returns None if there isn ' t a parcel directory
async fn filter_files<P: AsRef<Path>>(
    root_path: P,
) -> Option<impl tokio::stream::Stream<Item = PathBuf>> {
    let readdir = match tokio::fs::read_dir(root_path.as_ref().join(PARCEL_DIR)).await {
        Ok(r) => r,
        Err(e) if e.kind() == std::io::ErrorKind::NotFound => return None,
        Err(e) => panic!("unable to read parcel directory: {:?}", e),
    };
    Some(
        readdir
            .map(|entry| entry.expect("Error while reading parcel directory").path())
            .filter(|p| p.extension().unwrap_or_default() == PARCEL_EXTENSION),
    )
}
async fn filter_files < P : AsRef < Path > > ( root_path : P , ) -> Option < impl tokio :: stream :: Stream < Item = PathBuf > > { let readdir = match tokio :: fs :: read_dir ( root_path . as_ref ( ) . join ( PARCEL_DIR ) ) . await { Ok ( r ) => r , Err ( e ) if e . kind ( ) == std :: io :: ErrorKind :: NotFound => return None , Err ( e ) => panic ! ( " " e ) , } ; Some ( readdir . map ( | entry | entry . expect ( " " ) . path ( ) ) . filter ( | p | p . extension ( ) . unwrap_or_default ( ) == PARCEL_EXTENSION ) , ) }
Filters all items in a parcel directory that do not match the proper extensions.
Filters all items in a parcel directory that do not match the proper extensions .
root_path
P
root_path
P