History

rust: types: rename Opaque::raw_get to cast_into

In the previous patch we added Opaque::cast_from() that performs the opposite operation to Opaque::raw_get(). For consistency with this naming, rename raw_get() to cast_from(). There are a few other options such as calling cast_from() something closer to raw_get() rather than renaming this method. However, I could not find a great naming scheme that works with raw_get(). The previous version of this patch used from_raw(), but functions of that name typically have a different signature, so that's not a great option.

Alice Ryhl committed 1 year ago

Commit 64fb8101 parent 8802e168 files · +15 −15Browse files

Showing the changes to rust/kernel/workqueue.rs (1 of 8 files). Show all

Unified · Split

rust/kernel/workqueue.rs+1−1
@@ -403,7 +403,7 @@ impl<T: ?Sized, const ID: u64> Work<T, ID> { · 402 unmodified lines
403403 //
404404 // A pointer cast would also be ok due to `#[repr(transparent)]`. We use `addr_of!` so that
405405 // the compiler does not complain that the `work` field is unused.
406− unsafe { Opaque::raw_get(core::ptr::addr_of!((*ptr).work)) }
406+ unsafe { Opaque::cast_into(core::ptr::addr_of!((*ptr).work)) }
407407 }
408408 }
409409