Future is not send.

This commit is contained in:
Tom Alexander 2024-10-18 21:29:15 -04:00
parent 8868cfb63f
commit b6cc7a70b7
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 7 additions and 3 deletions

View File

@ -61,7 +61,7 @@ async fn get_output_directory(config: &Config) -> Result<PathBuf, CustomError> {
Ok(output_directory)
}
fn filter_to_post_directories(entry: &DirEntry) -> Result<bool, CustomError> {
async fn filter_to_post_directories(entry: &DirEntry) -> Result<bool, CustomError> {
Ok(true)
}

View File

@ -1,3 +1,4 @@
use std::future::Future;
use std::ops::AsyncFn;
use std::path::Path;
@ -9,7 +10,10 @@ use crate::error::CustomError;
pub(crate) fn walk_fs<'p, P: AsRef<Path> + std::marker::Send + 'p>(
root: P,
predicate: fn(&DirEntry) -> Result<bool, CustomError>,
predicate: impl AsyncFn(&DirEntry) -> Result<bool, CustomError>
+ std::marker::Send
+ 'p
+ std::marker::Copy,
) -> BoxFuture<'p, Result<Vec<DirEntry>, CustomError>> {
async move {
let mut ret = Vec::new();
@ -20,7 +24,7 @@ pub(crate) fn walk_fs<'p, P: AsRef<Path> + std::marker::Send + 'p>(
let child_entries = walk_fs(entry.path(), predicate).await?;
ret.extend(child_entries);
}
if predicate(&entry)? {
if predicate(&entry).await? {
ret.push(entry);
}
}