4 ms·
I am not familiar with this crate, but I am with Rust, here’s my take: Copy is a specific thing in Rust, it means that if a type implements the Copy trait, it
by steveklabnik 3y ago
I am not familiar with this crate, but I am with Rust, here’s my take:
Copy is a specific thing in Rust, it means that if a type implements the Copy trait, it can be copied via a memcpy, that is, it’s like a “shallow” copy as opposed to a “deep” copy.
So they’re not “copying without copying”, they’re letting you treat a non-Copy type as a Copy type, in my understanding.
> what if it’s something that doesn’t have a static lifetime?
The read me says it requires static content so the answer is “you can’t do that.”
- skybrian 3y agoCould you use position-independent internal references (relative pointers) to make data copyable? Does Rust have good support for that?
- steveklabnik 3y agoRust does not have native support for relative pointers, so you'd have to hack that together with unsafe. It's not generally done.