mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
rust: pin-init: examples: use Wrapper::pin_init instead of manual reimplementation
`UnsafeCell` gains the method via the extension trait `Wrapper`. Link: https://patch.msgid.link/20260729-merge-init-v2-1-26adf47109e7@garyguo.net Signed-off-by: Gary Guo <gary@garyguo.net>
This commit is contained in:
parent
6d0795b507
commit
c998b661b7
|
|
@ -79,11 +79,7 @@ pub fn new(val: impl PinInit<T>) -> impl PinInit<Self> {
|
|||
wait_list <- ListHead::new(),
|
||||
spin_lock: SpinLock::new(),
|
||||
locked: Cell::new(false),
|
||||
data <- unsafe {
|
||||
pin_init_from_closure(|slot: *mut UnsafeCell<T>| {
|
||||
val.__pinned_init(slot.cast::<T>())
|
||||
})
|
||||
},
|
||||
data <- UnsafeCell::pin_init(val),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user