Replies: 2 comments
-
I don't think you can reflect functions unfortunately. what happens if you wrap it in an |
Beta Was this translation helpful? Give feedback.
-
You can't reflect functions yet (see #13152). The If you can, I’d maybe give the field a custom default value like: |
Beta Was this translation helpful? Give feedback.
-
Hey, I'm trying to contribute something to a crate, and I would like to extend an existing enum with a new field, which would contain an
fn
as a field.My problem is that the author of the crate is already deriving
Reflect
for this enum, and I would prefer not to break that if possible.However here I'm a little stuck:
TypePath
is not implemented for thefn(..)->..
#[reflect(ignore)]
, then the error becomes thatDefault
is not implemented for thefn(..)->..
fn(..)->..
, then I can successfully add#[derive(TypePath)]
on it, but then I need to manually implementReflect
which has many methods I don't understand, and it also gave me some doubt that maybe it's not the proper way to go.So how should I go about implementing this while having the minimum impact on the crate?
Beta Was this translation helpful? Give feedback.
All reactions