Skip to content

Find a better way of representing complex numbers types in Rust #72

Closed
@emilio

Description

@emilio

I plan to land parsing and code generation support for complex types. My initial plan is landing it as a constant array of items, but that doesn't mean we can't do better.

We'd need to add a new TypeKind::Complex(ItemId), then use that to represent complex types. Then, at code generation, we can do something like what we do with unions, and conditionally prepend a prelude that might look like:

#[repr(C)]
#[derive(ABunchOfThings)]
struct __BindgenComplex<T> {
    real: T,
    imaginary: T,
};

With arithmetic operations on top of it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions