Having some trouble mapping a string to a mutable struct method, and putting it in static memory.
What I'd essentially like to do is:
static dict: HashMap<&str, dyn FnMut(&mut Foo, &mut Bar, &[&str])> = {
let m = HashMap::new();
m.insert("ping", |foo, bar, args| {
// ...
});
};
(this blows up with an undecipherable compiler hint)
I'd like this in either static or const memory, I'm not entirely sure the difference in Rust. This dictionary is a constant though, it will never change, and it's pointless to have one per class as a struct var.
Can anyone help me get this to work?
