Skip to content

stack overflow #13

@jb-alvarado

Description

@jb-alvarado

Hello,
ich use your crate in a tokio runtime and some how I get on some machines a stack overflow with this code:

let mut m3u8_files = Vec::new();

let mut entries = WalkDir::new(path).filter(move |entry| async move {
    if entry.path().is_file() && entry.path().extension().is_some_and(|ext| ext == "m3u8") {
        return Filtering::Continue;
    }

    Filtering::Ignore
});

loop {
    match entries.next().await {
        Some(Ok(entry)) => {
            m3u8_files.push(entry.path().to_string_lossy().to_string());
        }
        Some(Err(e)) => {
            error!(target: Target::file_mail(), "error: {e}");
            break;
        }
        None => break,
    }
}

With this not:

let mut entries = WalkDir::new(path);

while let Some(Ok(entry)) = entries.next().await {
    if entry.path().is_file() && entry.path().extension().is_some_and(|ext| ext == "m3u8") {
        m3u8_files.push(entry.path().to_string_lossy().to_string());
    }
}

Is my code on top wrong? I though I get it correct from doc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions