Re: [PATCH v4 1/7] rust: alloc: add Vec::try_push_init and Vec::push_init
From: Alexandre Courbot
Date: Wed Oct 21 2026 - 08:44:11 EST
On Fri Oct 16, 2026 at 10:53 AM JST, Eliot Courtney wrote:
> Add `Vec::try_push_init` for fallible initializers (`impl Init<T, E>`)
> and a new sum error type `TryPushInitError<I, E>` that it returns. If
> allocation fails, it hands back the original initializer. A `From` impl
> for `Error` lets callers decay the `TryPushInitError<I, E>` to a regular
> Error if they want.
>
> Add `Vec::push_init` which is the init-infallible version of
> `try_push_init`.
>
> Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>