Skip to content

hide type detail when using type alias? #711

@myrfy001

Description

@myrfy001

For the following rust code, with command cbindgen --lang C t.rs

type Context = HashMap<String, String>;

#[no_mangle]
pub extern fn new_context() -> *const Context{}

will generate the following C code:

typedef struct HashMap_String__String HashMap_String__String;

typedef struct HashMap_String__String Context;

const Context *new_context(void);

I don't want to let the enduser know the detail of Context is a HashMap_String__String, they should only know it's a type of Context, how can I do that?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions