diff options
| author | Benno Lossin <lossin@kernel.org> | 2025-10-16 23:05:39 +0200 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2025-10-21 00:40:12 +0200 |
| commit | fc2b38de4c01710ecb9ebb9ecdce9a7bf433e9a8 (patch) | |
| tree | 1c21a203d799fa2402e60803665a949e11cebd49 /drivers/gpu/drm/tyr/driver.rs | |
| parent | e6901808a3b28d8bdabfa98a618b2eab6f8798e8 (diff) | |
add `[pin_]init_scope` to execute code before creating an initializer
In more complex cases, initializers need to run arbitrary code before
assigning initializers to fields. While this is possible using the
underscore codeblock feature (`_: {}`), values returned by such
functions cannot be used from later field initializers.
The two new functions `[pin_]init_scope` allow users to first run some
fallible code and then return an initializer which the function turns
into a single initializer. This permits using the same value multiple
times by different fields.
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
[ Fix typo in commit message: s/functinos/functions/. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/tyr/driver.rs')
0 files changed, 0 insertions, 0 deletions