nats.rs icon indicating copy to clipboard operation
nats.rs copied to clipboard

Remove useless use of `Option` around `HeaderMap`

Open paolobarbolini opened this issue 11 months ago • 2 comments

Calling HeaderMap::new doesn't allocate, but instead creates an empty hashmap.

Considering that code already has to check whether there really were any headers inside of the HeaderMap when the variant is Some, the Option around it didn't make sense.

paolobarbolini avatar Jul 22 '23 13:07 paolobarbolini

Considering that code already has to check whether there really were any headers inside of the HeaderMap when the variant is Some, the Option around it didn't make sense.

Just a bit of trivia as to why, before we used to send HMSG if headers were Some, even if they were empty.

caspervonb avatar Jul 24 '23 13:07 caspervonb

Boils down to this I think, Option signals semantics. Is an empty header map lighter than an empty header map?

This conflicts with #1003 pretty heavily so, may merge but not before that is merged.

caspervonb avatar Jul 27 '23 14:07 caspervonb