Re:Memory Safe Languages in Android 13
by jstimpfle on Friday December 02, 2022 @07:04AM
(#33829439)
This isn't an intrusively linked list.
Probably not the Clone trait but the Copy trait.
Re:Memory Safe Languages in Android 13
by steveklabnik on Friday December 02, 2022 @09:29AM
(#33830819)
> The equivalent of a generic memcpy is probably something like a .clone() call on a generic type that implements Clone.
If you type "memcpy" into the documentation search, rustdoc will point you to
* https://doc.rust-lang.org/stable/std/primitive.slice.html#me...
* https://doc.rust-lang.org/stable/std/intrinsics/fn.copy_nono... (Though it should really point to the reexport at https://doc.rust-lang.org/stable/std/ptr/fn.copy_nonoverlapp... )
The latter will also mention
> Implementing a linked list in Rust is somewhat challenging because of the safety issues that arise
Implementing linked list in any language that is not memory-safe is challenging because of safety issues. Rust just points it out.
The equivalent of a generic memcpy is probably something like a .clone() call on a generic type that implements Clone.