3 ms·
Assuming struct A has a reference to struct B, memcpy is a fine way to move struct A, and struct B cannot be moved while borrowed. Here's an example I put toge
by tene 7y ago
Assuming struct A has a reference to struct B, memcpy is a fine way to move struct A, and struct B cannot be moved while borrowed.
Here's an example I put together demonstrating this: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3a0bfadb6c196cde8588d8cd0fab8a91 https://play.rust-lang.org/?version=stable&mode=debug&editio...