Open
Description
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
Labels
No labels