Confirmed users
1,345
edits
Nnethercote (talk | contribs) |
Nnethercote (talk | contribs) |
||
| Line 49: | Line 49: | ||
* For components where Servo has demonstrated success. | * For components where Servo has demonstrated success. | ||
In terms of where to keep Rust crates, there are three options | In terms of where to keep Rust crates, there are three options. | ||
* Put the crate in mozilla-central or in Servo's repository. | * Put the crate in mozilla-central or in Servo's repository. | ||
** For binding code, the decision to put it into Gecko or Servo can be difficult. The best choice | ** For binding code, the decision to put it into Gecko or Servo can be difficult. The best choice depends on the details of the binding code in question. | ||
* Put the crate on [https://crates.io crates.io] and use Cargo to access it at build-time. | |||
** This is only suitable for highly general-purpose crates, such as <tt>smallvec</tt>. | |||
* Put the crate somewhere else (e.g. a separate GitHub repository), and regularly vendor it into mozilla-central. | * Put the crate somewhere else (e.g. a separate GitHub repository), and regularly vendor it into mozilla-central. | ||
** This | ** This makes sense for pre-existing third-party crates that we choose to import. | ||
** Otherwise, this option is not recommended, because vendoring is something of a hassle. | |||
** | |||
In general, erring on the side of tighter coupling is advisable. For example, the <tt>heapsize</tt> crate used in memory reporting was moved to crates.io, and then other crates came to depend on it. Later on it needed major API changes, and we ended up replacing it with a new crate called <tt>malloc_size_of</tt> (stored in Servo's repository) because that was easier than modifying <tt>heapsize</tt>. | In general, erring on the side of tighter coupling is advisable. For example, the <tt>heapsize</tt> crate used in memory reporting was moved to crates.io, and then other crates came to depend on it. Later on it needed major API changes, and we ended up replacing it with a new crate called <tt>malloc_size_of</tt> (stored in Servo's repository) because that was easier than modifying <tt>heapsize</tt>. | ||