Better explaination for the cast
This commit is contained in:
parent
287a168b18
commit
3de622cdfd
|
@ -149,7 +149,7 @@ impl PyRawObject {
|
||||||
let value = f();
|
let value = f();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
// Do not remove the `as *mut u8` part or you'll get some weird overflow error
|
// The `as *mut u8` part is required because the offset is in bytes
|
||||||
let ptr = (self.ptr as *mut u8).offset(T::OFFSET) as *mut T;
|
let ptr = (self.ptr as *mut u8).offset(T::OFFSET) as *mut T;
|
||||||
std::ptr::write(ptr, value);
|
std::ptr::write(ptr, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue