You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a really handy crate! However, it would be even better if it allowed me to wrap the fields not only in Option<...> but also in my own custom type. My specific use case is that I'm implementing styling support for our WebAssembly plotting library – and the styles can either have some specific value, or be None (which means "do not change") or Unset (which means "reset to default").
Thank you for the suggestion. This would be a nice addition. However it would make some features of optfield basically impossible to implement without requiring more information about the wrapper type: merge_fn and from.
An option would be to add a wrapper argument taking the type to use instead of Option and disable merge_fn and from when it is used.
I may look into it when I have the time, but would also gladly assist and review a PR.
This is a really handy crate! However, it would be even better if it allowed me to wrap the fields not only in
Option<...>
but also in my own custom type. My specific use case is that I'm implementing styling support for our WebAssembly plotting library – and the styles can either have some specific value, or beNone
(which means "do not change") orUnset
(which means "reset to default").This is my code without using
optfield
:With
optfield
, I can replace the code forTraceStylePatch
andTraceStyle::patch
with:However,
TraceStyle
andComputedTraceStyle
still have to remain duplicated.The text was updated successfully, but these errors were encountered: