Skip to content

Instantly share code, notes, and snippets.

@silphire
Created April 5, 2019 20:54
Show Gist options
  • Save silphire/b6470992bca6d1aaba39ed061ff15e09 to your computer and use it in GitHub Desktop.
Save silphire/b6470992bca6d1aaba39ed061ff15e09 to your computer and use it in GitHub Desktop.
I don't know why function type cannot be used as a type parameter
use std::collections::HashMap;
use std::any::Any;
fn main() {
let funcs: Option<HashMap<isize, &Any>> = Some(HashMap::new());
// expected expression, found keyword `fn`
let func = funcs.map(|v| (*v.get(0)).downcast_ref<fn(n: isize)>());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment