I want to use variables outside the scope of the closure inside custom_function(|d: DirEntry| { //code })
I am new to rust so please forgive me if I make a mistake.
Currently, this yeilds a type error because the closure is capturing outside variables.


Even using move or inner functions does not solve this problem.
This functionality would be particularly useful when the value of outside_var can change or is not determined from the start.