Created
January 24, 2020 13:33
-
-
Save rust-play/4f488339b804ac9bd9373fc01853c5a4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn identity<T: ?Sized, F>(f: F) -> F | |
where | |
F: for<'a> Fn(&'a T) -> &'a T, | |
{ | |
f | |
} | |
fn foo(_f: impl for<'a> Fn(&'a str) -> &'a str) {} | |
fn main() { | |
let closure = identity(|s: &str| s); | |
foo(closure); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment