Re:Dioxus 0.5: Web, Desktop, Mobile Apps in Rust
by skybrian on Thursday March 28, 2024 @02:17PM
(#39855428)
Could you use position-independent internal references (relative pointers) to make data copyable? Does Rust have good support for that?
Re:Dioxus 0.5: Web, Desktop, Mobile Apps in Rust
by steveklabnik on Thursday March 28, 2024 @04:24PM
(#39856861)
Rust does not have native support for relative pointers, so you'd have to hack that together with unsafe. It's not generally done.
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.”