style: Add an owned slice type which cbindgen can understand.

Passing these by value won't be ok of course, but that's fine.

I plan to combine this with https://github.com/eqrion/cbindgen/pull/333 to
actually be able to share representation for ~all the things, this is just the
first bit.

Box<T>, Atom and Arc<T> will be much easier since cbindgen can understand them
without issues.

It's boxed slices the only ones I should need something like this. I could avoid
it if I rely on Rust's internal representation, which we can per [1], but then I
need to teach cbindgen all about slices, which is generally hard, I think.

[1]: https://github.com/rust-lang/unsafe-code-guidelines/blob/master/reference/src/layout/pointers.md

Differential Revision: https://phabricator.services.mozilla.com/D29768
This commit is contained in:
Emilio Cobos Álvarez 2019-05-09 10:49:22 +00:00
parent 4b761848a0
commit 330bccd659
6 changed files with 252 additions and 1 deletions

View file

@ -143,6 +143,7 @@ pub mod logical_geometry;
pub mod matching;
#[macro_use]
pub mod media_queries;
pub mod owned_slice;
pub mod parallel;
pub mod parser;
pub mod rule_cache;
@ -188,6 +189,8 @@ pub use html5ever::Prefix;
#[cfg(feature = "servo")]
pub use servo_atoms::Atom;
pub use owned_slice::OwnedSlice;
/// The CSS properties supported by the style system.
/// Generated from the properties.mako.rs template by build.rs
#[macro_use]