Merge #351

351: Update Interoperability section r=eldruin a=abt8601

Following the discussion on #348, this PR proposes the following changes to the Interoperability section:

- Update descriptions regarding the availability of `core::ffi`.
- Remove mentions of `std::os::raw`.

I intentionally kept mentions of the `cty` crate and the `cstr_core` crate since the next section uses the former. We may also consider updating the following section to use `core::ffi` instead of the `cty` crate.

This PR also introduces two additional changes.

First, it changes the descriptions regarding the implicit conversion between C and Rust types. The book says that the compiler implicitly converts between the two types, but it doesn't sound right to say that the example (reproduced below) works because of the conversion. It works simply because, on platforms where `unsigned int` is 32-bit long, `c_uint` and `u32` are the same type because the former is a type alias of the latter. This PR also removes the `unsafe` from the example since I believe it plays no role.

```rust
unsafe fn foo(num: u32) {
    let c_num: c_uint = num;
    let r_num: u32 = c_num;
}
```

Second, it changes the text formatting in the type correspondence table. The types in the table now use code formatting. Also, the presentation of C pointer types is updated (e.g. `*char` → `char *`).

Closes #348.

Co-authored-by: Po-Yi Tsai <abt8601@protonmail.ch>
tree: 25b2058d2c65f9e268368a09d77e2601d35ac023
  1. .github/
  2. src/
  3. .gitattributes
  4. .gitignore
  5. book.toml
  6. CITATION.bib
  7. CODE_OF_CONDUCT.md
  8. LICENSE-APACHE
  9. LICENSE-CC-BY-SA
  10. LICENSE-MIT
  11. README.md
  12. triagebot.toml
README.md

The Embedded Rust Book

Documentation on how to use the Rust Programming Language to develop firmware for bare metal (microcontroller) devices

This project is developed and maintained by the Resources team.

See the issue tracker for more details. This book is a living document, and is updated continuously.

Online Copies of this Book

This book is located at https://docs.rust-embedded.org/book/

License

The Embedded Rust Book (this project) is distributed under the following licenses:

  • The code samples and free-standing Cargo projects contained within this book are licensed under the terms of both the MIT License and the Apache License v2.0.
  • The written prose contained within this book is licensed under the terms of the Creative Commons CC-BY-SA v4.0 license.

Copies of the licenses used by this project may also be found here:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Code of Conduct

Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the Resources team, promises to intervene to uphold that code of conduct.