3 ms·
Oh my good god. I'm hoping this is down to developer naivety rather than being a feature of rust.
by dirtydroog 6y ago
Oh my good god.
I'm hoping this is down to developer naivety rather than being a feature of rust.
- sockgrant 6y ago1) he should pass by reference to avoid the extra copy. So in his example yes it’s dev naivety 2) but somewhere somehow this object will deallocate, so his trick of putting it to another thread would work if the deal location takes awhile. Same for cpp if you have a massive object in a unique ptr. So it’s not a rust issue
- renewiltord 6y agoWhere's the extra copy? I don't see one. He's moving the struct into the function, getting size and then dropping it.
- VWWHFSfQ 6y ago> avoid the extra copy there is no copy happening here
- ReactiveJelly 6y agoThe same could happen in C++, I think. Destructors are supposed to be called recursively.
- wizzwizz4 6y agoIt's not a feature of Rust; it's a "feature" of the way we design operating systems and processors. This is the same in C.