Skip to content

Conversation

patrickfreed
Copy link
Contributor

RUST-1109

This PR implements the rawbson! and rawdoc! macros to allow easier creation of raw BSON types. They are largely copy/pasted from the existing bson! and doc! macros with just a few modifications to build raw BSON. This PR also updates a number of examples and tests to use rawdoc! instead of building RawDocumentBuf values manually or from Document.


// Finished with trailing comma.
(@array [$($elems:expr,)*]) => {
<$crate::RawArrayBuf as std::iter::FromIterator::<$crate::RawBson>>::from_iter(vec![$($elems,)*])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't as efficient as it could be, but it was a lot easier then rewriting this to build up the RawArrayBuf like we do for RawDocumentBuf. I field RUST-1118 to cover the work for doing this without the Vec allocation.

@patrickfreed patrickfreed merged commit 481d9e6 into mongodb:master Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants