-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use RawDocument/Buf in doc! #426
Comments
Hey Dan, I'd recommend using the
This will allow you to avoid the additional allocation of a
Because I think there's also some room for improvement in the driver API to accept raw documents in certain places we currently accept regular documents (like update documents, which I believe is your use case here) so that you don't need to allocate a |
Yeah, that makes sense but doesn't work for my use case since raw document bytes are being sent and then deserialized to RawDocument to avoid overhead (since we know it should always be a valid document). Appreciate the tip, didn't know TryFrom was implemented! & thanks for the consideration for v3! Being able to accept a raw document for updates would be useful! |
Filed RUST-1747. Going to close this out but feel free to open another issue if you run into anything else! |
Something I'd like to be able to do is:
This doesn't compile today, maybe understandably - since the bytes could be invalid - but the only alternative seems to be to allocate (twice?):
doc.to_raw_document_buf().to_document().unwrap()
but it would be nice to have a usable RawDocument without extra/intermediate allocation. MaybeRawDocument
could have a validate method which returns aResult<ValidatedRawDocument>
which could be used in the doc macro?The text was updated successfully, but these errors were encountered: