mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-24 23:31:56 +02:00
Update Chromium Rust policy (#2530)
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
This commit is contained in:
parent
7f0c591b0b
commit
665300e373
@ -1,16 +1,29 @@
|
|||||||
# Chromium Rust policy
|
# Chromium Rust policy
|
||||||
|
|
||||||
Chromium does not yet allow first-party Rust except in rare cases as approved by
|
Chromium's Rust policy can be found
|
||||||
Chromium's
|
[here](https://source.chromium.org/chromium/chromium/src/+/main:docs/rust.md;l=22).
|
||||||
[Area Tech Leads](https://source.chromium.org/chromium/chromium/src/+/main:ATL_OWNERS).
|
Rust can be used for both first-party and third-party code.
|
||||||
|
|
||||||
Chromium's policy on third party libraries is outlined
|
Using Rust for pure first-party code looks like this:
|
||||||
[here](https://chromium.googlesource.com/chromium/src/+/main/docs/adding_to_third_party.md#rust) -
|
|
||||||
Rust is allowed for third party libraries under various circumstances, including
|
|
||||||
if they're the best option for performance or for security.
|
|
||||||
|
|
||||||
Very few Rust libraries directly expose a C/C++ API, so that means that nearly
|
```bob
|
||||||
all such libraries will require a small amount of first-party glue code.
|
"C++" Rust
|
||||||
|
.- - - - - - - - - -. .- - - - - - - - - - -.
|
||||||
|
: : : :
|
||||||
|
: Existing Chromium : : Chromium Rust :
|
||||||
|
: "C++" : : code :
|
||||||
|
: +---------------+ : : +----------------+ :
|
||||||
|
: | | : : | | :
|
||||||
|
: | o-----+-+-----------+-+-> | :
|
||||||
|
: | | : Language : | | :
|
||||||
|
: +---------------+ : boundary : +----------------+ :
|
||||||
|
: : : :
|
||||||
|
`- - - - - - - - - -' `- - - - - - - - - - -'
|
||||||
|
```
|
||||||
|
|
||||||
|
The third-party case is also common. It's likely that you'll also need a small
|
||||||
|
amount of first-party glue code, because very few Rust libraries directly expose
|
||||||
|
a C/C++ API.
|
||||||
|
|
||||||
```bob
|
```bob
|
||||||
"C++" Rust
|
"C++" Rust
|
||||||
@ -27,12 +40,9 @@ all such libraries will require a small amount of first-party glue code.
|
|||||||
`- - - - - - - - - -' `- - - - - - - - - - - - - - - - - - - - - - -'
|
`- - - - - - - - - -' `- - - - - - - - - - - - - - - - - - - - - - -'
|
||||||
```
|
```
|
||||||
|
|
||||||
> First-party Rust glue code for a particular third-party crate should normally
|
The scenario of using a third-party crate is the more complex one, so today's
|
||||||
> be kept in `third_party/rust/<crate>/<version>/wrapper`.
|
course will focus on:
|
||||||
|
|
||||||
Because of this, today's course will be heavily focused on:
|
|
||||||
|
|
||||||
- Bringing in third-party Rust libraries ("crates")
|
- Bringing in third-party Rust libraries ("crates")
|
||||||
- Writing glue code to be able to use those crates from Chromium C++.
|
- Writing glue code to be able to use those crates from Chromium C++. (The same
|
||||||
|
techniques are used when working with first-party Rust code).
|
||||||
If this policy changes over time, the course will evolve to keep up.
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user