aboutsummaryrefslogtreecommitdiffstats
path: root/rust/pin-init/examples/static_init.rs
diff options
context:
space:
mode:
authorBenno Lossin <[email protected]>2025-05-29 08:10:24 +0000
committerBenno Lossin <[email protected]>2025-06-11 19:13:56 +0000
commite832374ccadf4d1ce7bd40a85b9320bd7fbb3628 (patch)
tree4c6a78a7786337fbb0848677ae581be1734071aa /rust/pin-init/examples/static_init.rs
parentrust: pin-init: improve safety documentation for `impl<T> [Pin]Init<T> for T` (diff)
downloadkernel-e832374ccadf4d1ce7bd40a85b9320bd7fbb3628.tar.gz
kernel-e832374ccadf4d1ce7bd40a85b9320bd7fbb3628.zip
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: Alice Ryhl <[email protected]> Link: https://github.com/Rust-for-Linux/pin-init/pull/62/commits/58612514b256c6f4a4a0718be25298410e67387a [ Also fix a compile error in block. - Benno ] Reviewed-by: Boqun Feng <[email protected]> Link: https://lore.kernel.org/all/[email protected] [ Add title prefix `rust: pin-init`. - Benno ] Signed-off-by: Benno Lossin <[email protected]>
Diffstat (limited to 'rust/pin-init/examples/static_init.rs')
0 files changed, 0 insertions, 0 deletions