Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Returner {
- val: i32,
- }
- impl<'a> Returner {
- fn get(&'a self) -> Box<Fn(i32) -> i32> {
- Box::new(|x| x + self.val)
- }
- }
- struct Returner {
- val: i32,
- }
- impl<'a> Returner {
- fn get(&'a self) -> Box<(Fn(i32) -> i32) + 'a> {
- return Box::new(move |x| x + self.val);
- }
- }
Add Comment
Please, Sign In to add comment