Post #4152263
2026-07-28 01:00 UTC
Since Rust still doesn't implement Default for [u8; 2048], I find myself pulling in the (fantastic) zerocopy crate just to get new_zeroed.
Because zerocopy::FromZeroes is _absolutely_ implemented for arrays of all sizes, unlike Default.
Replies (2)
-
@ephemeron@infosec.exchange 2026-07-28 01:56
@cliffle@hachyderm.io https://doc.rust-lang.org/std/array/fn.from_fn.html could do it, though not sure about relative performance.
-
@penguin42@mastodon.org.uk 2026-07-28 01:26
@cliffle@hachyderm.io Why doesn't Rust implement that - it seems obvious?