diff options
| author | Benno Lossin <lossin@kernel.org> | 2026-01-16 11:54:25 +0100 |
|---|---|---|
| committer | Benno Lossin <lossin@kernel.org> | 2026-01-17 10:51:42 +0100 |
| commit | aeabc92eb2d8c27578274a7ec3d0d00558fedfc2 (patch) | |
| tree | b90dee22d567510997fa6397a2b4199c951dc62c /tools/perf/lib/Documentation/tutorial/git@git.tavy.me:linux.git | |
| parent | 4883830e9784bdf6223fe0e5f1ea36d4a4ab4fef (diff) | |
rust: pin-init: add `#[default_error(<type>)]` attribute to initializer macros
The `#[default_error(<type>)]` attribute can be used to supply a default
type as the error used for the `[pin_]init!` macros. This way one can
easily define custom `try_[pin_]init!` variants that default to your
project specific error type. Just write the following declarative macro:
macro_rules! try_init {
($($args:tt)*) => {
::pin_init::init!(
#[default_error(YourCustomErrorType)]
$($args)*
)
}
}
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Benno Lossin <lossin@kernel.org>
Diffstat (limited to 'tools/perf/lib/Documentation/tutorial/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
