π«Unsafe snowball
Dereference of a raw pointer
let mut num = 5;
let r1 = &num as *const i32;
unsafe {
let x = *r1; // only in unsafe blocks!
}Calling unsafe functions
unsafe func dangerous() { ... }
unsafe {
dangerous(); // ok, if you are cool with it Β―\_(γ)_/Β―
}
dangerous(); // nah, you can't do that here!Pointer arithmetic
Last updated