Skip to content

Allow constructing structs through associated fields  #17

Open
@arielb1

Description

@arielb1

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
    }};
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions