I have a struct
struct MyType<T: Fn(u32) -> u32> {
my_thingy: T
}
This struct is pretty cool! I'd like to make a wrapper for it.
struct MyWrapper {
my_type: MyType<...>
}
impl MyWrapper {
pub fn new() -> MyWrapper {
MyWrapper {
my_type: MyType { my_thingy: |x| x + 4 }
}
}
}
What do I put in ...? I know I can resolve this with Box<dyn ...> and modifying MyType to take a trait. Is there a way to avoid the heap and not change MyType?