diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-09 02:06:09 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-04-09 02:06:09 +0530 |
commit | 93c41fba695e55fe2c5f5b19408a737c650b811c (patch) | |
tree | 6a3d761bc72e1414201ce7967c43fe0f486496aa /components/layout/flow.rs | |
parent | 4da38cdd7c26d24d6c9de75d3f3509ae372dd25b (diff) | |
parent | c906d06d4e99ecb7ac0cf25367c506db697ccb2e (diff) | |
download | servo-93c41fba695e55fe2c5f5b19408a737c650b811c.tar.gz servo-93c41fba695e55fe2c5f5b19408a737c650b811c.zip |
Auto merge of #10484 - emilio:reupdate-stylo-bindings, r=bholley
geckolib: reupdate bindings to allow easy union modifications
This commit updates the current bindings with a m-c trunk build.
This improves quite a few things:
* It adds `Debug` support for structs, which should be easy.
* It generates unnamed structs definitions.
* And... It allows changing union types directly!
The way mutating a union works is as follows. Each union field has an
unsized field of type `__BindgenUnionField<T>`, where `T` is the type of
the field.
The field has two unsafe methods, `as_ref` and `as_mut`, that would work
as follows (assuming 64 bit pointers):
````rust
let u = nsStyleUnion {
mInt: Default::default(),
mFloat: Default::default(),
mPointer: Default::default(),
_bindgen_data_: 0,
};
unsafe {
assert_eq!(*u.mInt.as_ref() == 0);
*u.mPointer.as_mut() = !0 as *mut _;
assert_eq!(*u.mInt.as_ref() == !0);
*u.mInt.as_mut() = 0;
assert_eq!(*u.mInt.as_ref() == 0);
assert_eq!(*u.mPointer.as_ref() == (!0 << 32) as *mut _);
}
```
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10484)
<!-- Reviewable:end -->
Diffstat (limited to 'components/layout/flow.rs')
0 files changed, 0 insertions, 0 deletions