auto merge of #5852 : thestinger/rust/ffi, r=thestinger
This commit is contained in:
commit
8b74efaa7b
1 changed files with 5 additions and 4 deletions
|
@ -186,10 +186,11 @@ A `#[packed]` attribute is available, which will lay out the struct members with
|
||||||
However, there are currently no guarantees about the layout of an `enum`.
|
However, there are currently no guarantees about the layout of an `enum`.
|
||||||
|
|
||||||
Rust's owned and managed boxes use non-nullable pointers as handles which point to the contained
|
Rust's owned and managed boxes use non-nullable pointers as handles which point to the contained
|
||||||
object. However, they should not be manually because they are managed by internal allocators.
|
object. However, they should not be manually created because they are managed by internal
|
||||||
Borrowed pointers can safely be assumed to be non-nullable pointers directly to the type. However,
|
allocators. Borrowed pointers can safely be assumed to be non-nullable pointers directly to the
|
||||||
breaking the borrow checking or mutability rules is not guaranteed to be safe, so prefer using raw
|
type. However, breaking the borrow checking or mutability rules is not guaranteed to be safe, so
|
||||||
pointers (`*`) if that's needed because the compiler can't make as many assumptions about them.
|
prefer using raw pointers (`*`) if that's needed because the compiler can't make as many assumptions
|
||||||
|
about them.
|
||||||
|
|
||||||
Vectors and strings share the same basic memory layout, and utilities are available in the `vec` and
|
Vectors and strings share the same basic memory layout, and utilities are available in the `vec` and
|
||||||
`str` modules for working with C APIs. Strings are terminated with `\0` for interoperability with C,
|
`str` modules for working with C APIs. Strings are terminated with `\0` for interoperability with C,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue