| commit | d9eb4c3f75435b008881062ffa77bf0d1527b37d | [log] [tgz] |
|---|---|---|
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | Mon May 08 10:06:29 2023 +0000 |
| committer | GitHub <noreply@github.com> | Mon May 08 10:06:29 2023 +0000 |
| tree | 25b2058d2c65f9e268368a09d77e2601d35ac023 | |
| parent | f27632ce1213f73fa8e380857a5e7c1dc16e3b97 [diff] | |
| parent | 7318666753e71097ad78ebfb4f1bb84575f60e73 [diff] |
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>
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.
This book is located at https://docs.rust-embedded.org/book/
The Embedded Rust Book (this project) is distributed under the following licenses:
Copies of the licenses used by this project may also be found here:
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.
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.