aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/init
diff options
context:
space:
mode:
authorBenno Lossin <[email protected]>2023-08-14 08:47:48 +0000
committerMiguel Ojeda <[email protected]>2023-08-21 14:31:49 +0200
commit7f8977a7fe6df9cdfe489c641058ca5534ec73eb (patch)
treedf8a424a9413189899c2033199ad86918a4d54b2 /rust/kernel/init
parent1a8076ac6d83825bedb2050e67db0f2635acbb09 (diff)
rust: init: add `{pin_}chain` functions to `{Pin}Init<T, E>`
The `{pin_}chain` functions extend an initializer: it not only initializes the value, but also executes a closure taking a reference to the initialized value. This allows to do something with a value directly after initialization. Suggested-by: Asahi Lina <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Cleaned a few trivial nits. ] Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/kernel/init')
-rw-r--r--rust/kernel/init/__internal.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/init/__internal.rs b/rust/kernel/init/__internal.rs
index 12e195061525..db3372619ecd 100644
--- a/rust/kernel/init/__internal.rs
+++ b/rust/kernel/init/__internal.rs
@@ -13,7 +13,7 @@ use super::*;
///
/// [nomicon]: https://doc.rust-lang.org/nomicon/subtyping.html
/// [this table]: https://doc.rust-lang.org/nomicon/phantom-data.html#table-of-phantomdata-patterns
-type Invariant<T> = PhantomData<fn(*mut T) -> *mut T>;
+pub(super) type Invariant<T> = PhantomData<fn(*mut T) -> *mut T>;
/// This is the module-internal type implementing `PinInit` and `Init`. It is unsafe to create this
/// type, since the closure needs to fulfill the same safety requirement as the