achanda / ipnetwork

A library to work with CIDRs in rust
Apache License 2.0
121 stars 38 forks source link

Remove useless allocation when serializing #144

Closed paolobarbolini closed 2 years ago

paolobarbolini commented 2 years ago

Replaces Serializer::serialize_str with Serializer::collect_str, which serializes the output of the Display implementation without going through the extra allocation, if the Serializer supports it. For example the serde_json::Serializer supports it

achanda commented 2 years ago

Thanks @paolobarbolini 👍