mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
Start simplifying FFI ownership sugar This is step one of a series of changes planned to make the ownership sugar easier to use. This was blocked on #13038 *very* unsure about second commit. Don't like the thought of accepting types with destructors over FFI. Probably will revert it. Leaving it in for now in case you have some insight. Eventually at least for the borrowed stuff I want to use T directly (because the crates are merged now), instead of the fake void types. Perhaps for the others too. I might include those changes in this PR -- was originally planning to but I realized that these steps could be split out. Tentative plan for `Owned` (assuming it's not removed) is to have `Owned<T> <-> Box<T>` (same `T`, no "FFI type") conversions. We will only use ownership wrapper types for things with destructors, and try to keep the conversion simple. I'm envisioning a couple methods for arc/strong and a few more for box/owned. We may need to introduce new wrapper types for gecko-side managed objects (`RefPtr<T>`, `UniquePtr<T>`) but that should be all the wrapper types we have in the ownership sugar. This PR relies on the guarantee that `Option<&T>` and `Option<Box<T>>` are pointer-sized via the `NonZero` optimization. I am now less unconvinced that this is a good idea 😉. r? @emilio cc @mystor <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13569) <!-- Reviewable:end --> |
||
---|---|---|
.. | ||
.gitignore | ||
README.md | ||
regen.py | ||
regen.sh | ||
regen_atoms.py | ||
setup_bindgen.sh |
Geckolib tools
This directory contains simple tools for generating the Rust bindings for stylo.
setup_bindgen.sh
This clones Servo's version of bindgen, and uses llvm-3.8
library to build it. It will then be used to generate the Rust bindings.
regen.sh
This will regenerate the bindings for the ServoBindings.h
file in your gecko
build. The generated bindings live in components/style/gecko_bindings/bindings.rs
. For structs, the bindings are in components/style/gecko_bindings/structs_*