mirror-linux/rust/pin-init/examples
Benno Lossin 61d62ab08f rust: pin-init: remove `try_` versions of the initializer macros
The `try_[pin_]init!` versions of the initializer macros are
superfluous. Instead of forcing the user to always write an error in
`try_[pin_]init!` and not allowing one in `[pin_]init!`, combine them
into `[pin_]init!` that defaults the error to
`core::convert::Infallible`, but also allows to specify a custom one.

Projects using pin-init still can provide their own defaulting
initializers using the `try_` prefix by using the `#[default_error]`
attribute added in a future patch.

[ Adjust the definition of the kernel's version of the `try_`
  initializer macros - Benno]

Reviewed-by: Gary Guo <gary@garyguo.net>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: Benno Lossin <lossin@kernel.org>
2026-01-17 10:49:31 +01:00
..
big_struct_in_place.rs rust: pin-init: rename `zeroed` to `init_zeroed` 2025-06-11 21:13:56 +02:00
error.rs rust: pin-init: examples: error: use `Error` in `fn main()` 2025-09-11 23:25:54 +02:00
linked_list.rs rust: pin-init: remove `try_` versions of the initializer macros 2026-01-17 10:49:31 +01:00
mutex.rs rust: pin-init: examples, tests: add conditional compilation in order to compile under any feature combination 2025-06-11 21:13:56 +02:00
pthread_mutex.rs rust: pin-init: remove `try_` versions of the initializer macros 2026-01-17 10:49:31 +01:00
static_init.rs rust: pin-init: examples, tests: add conditional compilation in order to compile under any feature combination 2025-06-11 21:13:56 +02:00