Re: [PATCH v4 2/2] rust: init: add `write_[pin_]init` functions

From: Alice Ryhl
Date: Mon Aug 19 2024 - 07:36:25 EST


On Mon, Aug 19, 2024 at 1:25 PM Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
>
> Sometimes it is necessary to split allocation and initialization into
> two steps. One such situation is when reusing existing allocations
> obtained via `Box::drop_contents`. See [1] for an example.
> In order to support this use case add `write_[pin_]init` functions to the
> pin-init API. These functions operate on already allocated smart
> pointers that wrap `MaybeUninit<T>`.
>
> Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> Link: https://lore.kernel.org/rust-for-linux/f026532f-8594-4f18-9aa5-57ad3f5bc592@xxxxxxxxx/ [1]

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>