Skip to content

Rust type aliases #1187

Open
Open
@schreter

Description

@schreter

In #1181, I published a tentative implementation for Rust type aliases.

The problem to solve is the following: we have two bridges, one exporting the Rust type, the other declaring functions, which need to work with this type. Currently, one cannot express this, because trying to use the same type in the second bridge would fail, since RustType trait is already implemented. So we need a possibility to specify an alias.

The tentative implementation specifies the alias via type Name = ::path::Name, where Name must be same on both sides. That's somewhat bad, since ideal would be an use ::path::Name statement. However, use is not allowed in extern blocks.

The question: Do we want to allow use for Rust types on the bridge module level? Writing use ::path::Name at the bridge level would be idiomatic Rust and we could generate appropriate Rust type alias with checks and so on at that level, instead of misusing type syntax in an extern block for it.

Any other ideas how to express it?

Thanks.

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