We use IvarDrop mostly because Box is #[fundamental], which means we can't ensure that no Encode impl exist for it (even though we know that would very likely be wrong).
Instead, we might be able to (ab)use HRTBs, see this playground link for the general idea. This is also what bevy uses for their IntoSystem trait.
Ideally we'd be able to do avoid IvarDrop, IvarEncode and IvarBool altogether, and just do (with or without the ivar names):
ivar1: Ivar<Box<i32>, "ivar1">,
ivar2: Ivar<i32, "ivar2">,
ivar3: Ivar<bool, "ivar3">,
Still need to figure out how to actually do that in a struct (playground).
We use
IvarDropmostly becauseBoxis#[fundamental], which means we can't ensure that noEncodeimpl exist for it (even though we know that would very likely be wrong).Instead, we might be able to (ab)use HRTBs, see this playground link for the general idea. This is also what
bevyuses for theirIntoSystemtrait.Ideally we'd be able to do avoid
IvarDrop,IvarEncodeandIvarBoolaltogether, and just do (with or without the ivar names):Still need to figure out how to actually do that in a struct (playground).