rust: pin-init: add `zeroed()` & `Zeroable::zeroed()` functions
authorBenno Lossin <lossin@kernel.org>
Fri, 23 May 2025 14:50:59 +0000 (16:50 +0200)
committerBenno Lossin <lossin@kernel.org>
Wed, 11 Jun 2025 19:13:56 +0000 (21:13 +0200)
commitd67b37012080cf1978b5fd36f040a53f92152243
tree92326f2119239f1332866c5bae862b6a5a8fd6d0
parentc47024ba198b01cab6bb6e3e5a69b73ed2f2aa16
rust: pin-init: add `zeroed()` & `Zeroable::zeroed()` functions

`zeroed()` returns a zeroed out value of a sized type implementing
`Zeroable`.

The function is added as a free standing function, in addition to an
associated function on `Zeroable`, because then it can be marked `const`
(functions in traits can't be const at the moment).

Link: https://github.com/Rust-for-Linux/pin-init/pull/56/commits/809e4ec160579c1601dce5d78b432a5b6c8e4e40
Link: https://lore.kernel.org/all/20250523145125.523275-4-lossin@kernel.org
Signed-off-by: Benno Lossin <lossin@kernel.org>
rust/pin-init/src/lib.rs