Skip to content

Throwing initializers don't work #363

Description

@aDifferentJT

If my bridge module contains the below then the resulting generated Swift fails to compile, because it's trying to return from a convenience initialiser instead of calling .init

extern "Rust" {
    struct T;

    #[swift_bridge(init)]
    fn new() -> Result<T, String>;
}

as a workaround one can use the following, but it's not ideal.

extern "Rust" {
    struct T;

    #[swift_bridge(associated_to = T)]
    fn new() -> Result<T, String>;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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