owengage / fastnbt

Fast serde serializer and deserializer for Minecraft's NBT and Anvil formats
MIT License
185 stars 35 forks source link

Simplify `From<Tag> for u8` Implementation with Direct Cast #104

Closed hollowness-inside closed 5 months ago

hollowness-inside commented 5 months ago

Refactored the From<Tag> implementation to utilize direct casting instead of a match expression.

owengage commented 5 months ago

Seems reasonable! Thanks for the contributions. Can you change the unit test for this to check the explicit values? So basically that a compound is 10 etc.

At the moment I don't think there are any tests that fail if the Tag enum was re-ordered.

hollowness-inside commented 5 months ago

Done. Tests won't fail after re-ordering because discriminants are declared explicitly. I am happy to help.

owengage commented 5 months ago

Awesome. Thank you.