Skip to content

Instantly share code, notes, and snippets.

@Kimundi
Last active December 10, 2015 06:08
Show Gist options
  • Select an option

  • Save Kimundi/4391884 to your computer and use it in GitHub Desktop.

Select an option

Save Kimundi/4391884 to your computer and use it in GitHub Desktop.
fn main() {
apply_s(str::to_bytes("foo"), "foo", |buf, txt| {
buf == str::to_bytes(txt)
});
apply_g(str::to_bytes("bar"), "bar", |buf, txt| {
buf == str::to_bytes(txt)
});
}
fn apply_s(l: &[u8], r: &str, f: fn(&[u8], &str) -> bool) -> bool {
f(l, r)
}
fn apply_g<L, R>(l: L, r: R, f: fn(L, R) -> bool) -> bool{
f(l, r)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment