erickt / rust-zmq

Rust zeromq bindings.
Apache License 2.0
887 stars 190 forks source link

Message::with_capacity is unintuitive #215

Closed birkenfeld closed 5 years ago

birkenfeld commented 6 years ago

If you create a new message with capacity and send it, you'd expect a message with size zero to be sent. However, the message gets initialized to have the size equal the capacity.

Since I don't see a way to set the size manually afterwards, I think we need document this behavior carefully.

rotty commented 5 years ago

I agree that this unfortunate naming, as with_capacity is used by the Rust standard library with different semantics. I think we should maybe deprecate with_capacity and use a less-confusing name; e.g. with_size.

rotty commented 5 years ago

Should be fixed by PR #272.