Commit e832374c authored by Benno Lossin's avatar Benno Lossin
Browse files

rust: pin-init: change blanket impls for `[Pin]Init` and add one for `Result<T, E>`



Remove the error from the blanket implementations `impl<T, E> Init<T, E>
for T` (and also for `PinInit`). Add implementations for `Result<T, E>`.

This allows one to easily construct (un)conditional failing
initializers. It also improves the compatibility with APIs that do not
use pin-init, because users can supply a `Result<T, E>` to a  function
taking an `impl PinInit<T, E>`.

Suggested-by: default avatarAlice Ryhl <aliceryhl@google.com>
Link: https://github.com/Rust-for-Linux/pin-init/pull/62/commits/58612514b256c6f4a4a0718be25298410e67387a


[ Also fix a compile error in block. - Benno ]
Reviewed-by: default avatarBoqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/all/20250529081027.297648-2-lossin@kernel.org


[ Add title prefix `rust: pin-init`. - Benno ]
Signed-off-by: default avatarBenno Lossin <lossin@kernel.org>
parent 8b3d955f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment