Follow

Come on please I just want to store function pointers in a hashmap is that too much to ask 😭

@hapax The trick is to cast them to function type. Each function and callback has unique non-nameable type, but most can be cast to a regular type.
If you support closures with data, then you need Box<dyn Fn()>.

@kornel That was the trick! Using crossbeam also helped me be able to store the hashmap in a struct and be able to spawn threads with the saved Boxed functions.

Sign in to participate in the conversation
The Cabal

This is a server created by Jahziel Villasana (aka hapax). He's not sure what he's going to use it for yet...