Allow writing at arbitrary positions in MessagePack::Buffer
MessagePack::Buffer is a great utility for high-performance data processing in Ruby with and without msgpack encoding. In a couple of cases I've hit a use case where I have a binary data "template" where some parts of the binary data are msgpack encoded and some are not. The simplest example is prepending a header that makes the binary packet self-describing without the need for deserialization. In these cases, it would be great to be able to create a buffer for the template then write into it only the variable parts, saving the object creatiion and data copying that would otherwise happen.
The easiest way to do this is to add a move_to method for absolute positioning (0 == start).
Sounds good and reasonable idea.
My understanding is to add Buffer#move_to(buffer) method which moves internal data from the receiver to the argument without copying the data.
I'm suggesting we close this because:
- it's speculative feature request - can't be too critical to have as it's not been mentioned since 2013
-
MessagePack::Bufferis not supposed to be a general utility
If someone can show a pressing requirement, or a good example of where it makes code using this gem much better, we can reconsider.