8000 Does sort_by_key really need `'static` lifetime? · Issue #202 · BurntSushi/walkdir · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Does sort_by_key really need 'static lifetime? #202
Open
@dbarnett

Description

@dbarnett

I hit a snag with lifetimes and wondered: is it intentional that WalkDir.sort_by_key requires a 'static lifetime on its func argument instead of just the same lifetime as the WalkDir?

I was trying to do something like this:

let walker = WalkDir::new(path)
    .sort_by_key(|e| {
        let relative_path = e.path().strip_prefix(path).unwrap();
        some_func(relative_path)
    })

and that failed saying my path didn't live long enough for the required 'static lifetime, even though it does live until after walker was used and dropped.

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

      0