-
-
Notifications
You must be signed in to change notification settings - Fork 125
Does sort_by_key really need 'static lifetime? #202
Copy link
Copy link
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels