fMeow / arangors

Easy to use rust driver for arangoDB
https://docs.rs/arangors
MIT License
128 stars 28 forks source link

Make Document and Header derive Clone #78

Open blagovestb2c2 opened 3 years ago

blagovestb2c2 commented 3 years ago

Hello, it's a simple request, but is there any reason why these two structures don't derive Clone. I'm trying to return by value and I'm struggling a bit how to get an owned Document out of the local results vector

blagovestb2c2 commented 3 years ago

I found out how to solve my problem using Vec::swap_remove, but I still wonder about Clone (maybe even Eq/PartialEq?)

fMeow commented 3 years ago

Well, I am a little against the idea to add Clone to Document and Header. Say we have a document and a cloned document, and we made different changes in these two documents, then it can be inconsistent when you update it in arangodb. The liability can be passed to the user of arangors to avoid such cases, but I think it better to avoid it in the first place.

As for your use case, I think the local results is mutable and so you can just move the ownership of the element in a vec to another variable.