-
Type:
Task
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
LeWimbes has created PR #590: Borrow the buffer instead of owning it in bson-rust
Issue Text:
Similar to the idea in #328, `raw::Serializer` now takes a `&mut Vec<u8>`.
Because the `Vec` is borrowed, the same buffer can be reused for many serializations without reallocating.
- added *`serialize_to_buffer`*: serialize `&T` straight into a caller-supplied `Vec<u8>`.
- *`serialize_to_vec`* still exists. It just allocates a `Vec<u8>` and forwards it to `serialize_to_buffer`.
Breaking change: `raw::Serializer::new()` now expects `&mut Vec<u8>`.