eval
Log in

Capture by Value with move

10 points

Implement make_adder, which returns a closure that adds n to whatever it's called with. The closure must outlive the function call that created it, so it needs to own n rather than borrow it — that's what the move keyword is for.

Required signature

pub fn make_adder(n: i32) -> impl Fn(i32) -> i32;

Visible tests

Your solution

Log in to submit a solution.