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 doesn't implement PartialEq, so my understanding is that the props need to be borrowed props rather than owned props (as described here).
However, it seems like the Props derive macro still tries to derive owned props, which causes this compile error:
error[E0369]: binary operation `==` cannot be applied to type `&MyProps`
--> src/main.rs:46:10
|
46 | #[derive(Props)]
| ^^^^^
|
= note: this error originates in the derive macro `Props` (in Nightly builds, run with -Z macro-backtrace for more info)
If I give the struct an unused lifetime parameter instead, then the code works fine:
You're right - this is a missing feature! I think the Props macro can be updated with an attribute that enables/disables memoization (the requirement for 'static to be PartialEq).
We might call it 'no_memo` or something like that.
Specific Demand
Some of my components need to take an
Arc<RwLock<_>>
as a prop:This doesn't implement
PartialEq
, so my understanding is that the props need to be borrowed props rather than owned props (as described here).However, it seems like the
Props
derive macro still tries to derive owned props, which causes this compile error:If I give the struct an unused lifetime parameter instead, then the code works fine:
It would be handy if there was a way to derive borrowed props without needing a lifetime parameter - I couldn't spot one in the docs.
Implement Suggestion
Perhaps this could be a parameter to the
#[props]
attribute:The text was updated successfully, but these errors were encountered: