In my Rust program, I’m getting back values of the form *mut Foo
from a function written in C.
let x: *mut Foo = my_ffi_function();
What does this “*mut” notation even mean?
As far as I can tell, x
is just a pointer to a mutable Foo struct, the same as &mut Foo
.
This code compiles just fine:
let mut s: String = String::new();
let x: &mut String = &mut s;
let y: *mut String = x;
What’s difference between the two forms?