Closed
Description
I can't seem to figure out how to pass member functions as closures. I can do this:
fn my_unwrap<T>(o: Option<T>) -> T { o.unwrap() }
// name non-member function
let vals = opts.map(my_unwrap);
// take value, call member
let vals = opts.map(|o| o.unwrap());
// pass member function...?
let vals = opts.map(Option::unwrap); // doesn't compile
But I see no way to pass the actual member function within std::Option
. Perhaps I missed something in the documentation?
Metadata
Metadata
Assignees
Labels
No labels