I am implementing a UI layer in an async framework, and I am unable to pass Stretch around (including using it as a member on the "self" structure) in async code because MeasureFunc is not Send/Sync.
I believe that the change may be as simple as changing the type of Boxed's value to sys::Box<dyn Fn(Size<Number>) -> Size<f32>> + Send + Sync)
This, unfortunately, could be a breaking change since this is a publicly exposed enum, so before jumping in to create a PR, I wanted to see what the opinion would be of attempting this change. I'm new enough to understanding how async works that I am not sure what the likelihood that these functions in most codebase wouldn't already be Send + Sync.
I am implementing a UI layer in an async framework, and I am unable to pass Stretch around (including using it as a member on the "self" structure) in async code because MeasureFunc is not Send/Sync.
https://github.com/vislyhq/stretch/blob/28e00474a70297a07d3f5553e6108037f15eeb2a/src/node.rs#L15
I believe that the change may be as simple as changing the type of Boxed's value to
sys::Box<dyn Fn(Size<Number>) -> Size<f32>> + Send + Sync)
This, unfortunately, could be a breaking change since this is a publicly exposed enum, so before jumping in to create a PR, I wanted to see what the opinion would be of attempting this change. I'm new enough to understanding how async works that I am not sure what the likelihood that these functions in most codebase wouldn't already be Send + Sync.