Conversation
Ichbinjoe
left a comment
There was a problem hiding this comment.
I think you are right in asserting that this shouldn't break most occurrences of this library (due to auto-dereferencing), but this will break anyone trying to unwrap the box (because spoiler, no box to unwrap).
Approving because I'm going to assume you are the only real user of this library, and if you aren't, sorry to the person who is using this as well as doing weird boxy things with their chat.
jaecam
left a comment
There was a problem hiding this comment.
Yeah, the indirection is required for that hover event enum variant.
Not sure the BoxedChat alias is adding much value, but I can mostly get behind the boxed method from a code style POV. May want to also consider moving the point of indirection (which field is boxed), to increase cache locality (though there's currently no use of these types in craftio as far as I can see, so such an optimization is likely premature.)
The
Chattype is defined to have aVec<BoxedChat>as a member (indirectly, throughBaseChatComponenttype) because originally I thought the indirection was necessary inVectype. As it turns out, I didn't know Rust all that well when I wrote this code, and I realize now that we don't need the indirection in this case.I left the
BoxedChatalias and the.boxed()method on theChattype because indirection is required in one case (the only associated value forChatHoverEvent::ShowTextmust be aChattype).Review Notes: