Twister915 / mcproto-rs

Minecraft Protocol in Rust
Apache License 2.0
112 stars 21 forks source link

Cleanup chat boxing #3

Open Twister915 opened 3 years ago

Twister915 commented 3 years ago

The Chat type is defined to have a Vec<BoxedChat> as a member (indirectly, through BaseChatComponent type) because originally I thought the indirection was necessary in Vec type. 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 BoxedChat alias and the .boxed() method on the Chat type because indirection is required in one case (the only associated value for ChatHoverEvent::ShowText must be a Chat type).

Review Notes: