Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable use of custom serde serializer on nbt arrays #53

Merged
merged 1 commit into from
Jun 20, 2020

Conversation

Schuwi
Copy link
Contributor

@Schuwi Schuwi commented Jun 19, 2020

Because of a little oversight on my part when implementing the ser::ixx_array functions they currently take a &'a T: IntoIterator as their array reference parameter, which is only ever used for a call of .into_iterator on the passed argument. Thus the trait bound can be simplified to T: IntoIterator which would allow ser::ixx_array to be called manually (i.e. from a custom with_serializer implementation) with an iterator as the array reference parameter to manipulate the array values before serialization as used in the correspondingly implemented serialize_custom_serializer_array test.
This PR also rewrites parts of the roundtrip_nested_array test to make sure that no unnecessary memory allocation occurs on serialization.

Removed unnecessary reference on trait bounds of ser::ixx_array functions
Added test for using a custom serializer on nbt arrays
@Schuwi Schuwi marked this pull request as draft June 19, 2020 17:53
@Schuwi
Copy link
Contributor Author

Schuwi commented Jun 19, 2020

Okay, I ran another test with a real implementation of a custom serializer and everything seems to work fine

@Schuwi Schuwi marked this pull request as ready for review June 19, 2020 18:05
@atheriel
Copy link
Collaborator

Interesting test case. This looks good, thanks!

@atheriel atheriel merged commit 41124ff into PistonDevelopers:master Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants