News for hackers. Stuff that matters.
Re:Memory Safe Languages in Android 13 by cjg on Friday December 02, 2022 @04:52AM (#33828626)
Implementing a linked list in Rust is somewhat challenging because of the safety issues that arise. Luckily you don't have to, there's one in the standard library: https://doc.rust-lang.org/std/collections/struct.LinkedList....

The equivalent of a generic memcpy is probably something like a .clone() call on a generic type that implements Clone.

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

* https://doc.rust-lang.org/stable/std/ptr/fn.copy.html

Re:Memory Safe Languages in Android 13 by fiedzia on Friday December 02, 2022 @10:17AM (#33831594)
> 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.