A Box<fn>
can be coerced directly to a Box<dyn Fn>
, but this needs to be a separate step from the Box::new
call. Right now your map type will be inferred as holding the Box<fn>
type, so it might be enough to just give it an explicit type when you create it.
2 Likes