summaryrefslogtreecommitdiff
path: root/rust/kernel/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel/types.rs')
-rw-r--r--rust/kernel/types.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
index 63a2559a545f..9de8e0011b1d 100644
--- a/rust/kernel/types.rs
+++ b/rust/kernel/types.rs
@@ -413,6 +413,11 @@ impl<T> Opaque<T> {
pub const fn raw_get(this: *const Self) -> *mut T {
UnsafeCell::raw_get(this.cast::<UnsafeCell<MaybeUninit<T>>>()).cast::<T>()
}
+
+ /// The opposite operation of [`Opaque::raw_get`].
+ pub const fn cast_from(this: *const T) -> *const Self {
+ this.cast()
+ }
}
/// Types that are _always_ reference counted.