fields-in-traits-rfc
fields-in-traits-rfc copied to clipboard
Allow constructing structs through associated fields
This would be useful for rust-lang/rfcs#2102:
#[repr(C)]
pub union _Bindgen_somestruct_Field_0 {
pad_binder: binder_uintptr_t,
fd: u32
}
#[repr(C)]
pub union _Bindgen_somestruct_Field_target {
handle: u32,
ptr: binder_uintptr_t,
}
#[repr(C)]
pub struct somestruct {
_Field_0: _Bindgen_somestruct_Field_0,
target: _Bindgen_somestruct_Field_target
};
impl somestruct {
unsafe pad_binder: self._Field_0.pad_binder;
unsafe fd: self._Field_0.fd;
}
fn foo() {
let somestruct = unsafe { somestruct {
fd: 2,
target
}};
}