January 2019
Beginner to intermediate
554 pages
13h 31m
English
These pointers have a quirky type signature of being prefixed with a *, which also happens to be the dereference operator. They are mostly used in unsafe code. One needs an unsafe block to dereference them. There are two kinds of raw pointers in Rust:
As an added note, a reference can be cast to a raw pointer, as shown in the following code:
let a = &56;let a_raw_ptr = a as *const u32;// orlet b = &mut 5634.3;let b_mut_ptr = b as *mut T;
However, we can't cast a &T to a *mut T, as it would violate the borrowing rules that allow ...
Read now
Unlock full access