My understanding is that if
Foo is a struct,
&Foo is represented as a non-null pointer in memory and
Option<&Foo> is represented as a nullable pointer in memory. Is this always the case?
If it is always the case, should I write
&Foo as an argument type on the Rust side of FFI and as
const* Foo on the C side of FFI when the pointer must not be null and
Option<&Foo> in Rust and
const* Foo in C when the pointer may be null?
It seems that rusty-cheddar doesn’t currently do this. Is there a reason of the “don’t do that” sort why rusty-cheddar doesn’t do this automatically or is this just a matter of rusty-cheddar not having type rewriting rules that match rustc’s pointer optimizations yet?