Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for already_declared enums #125

Merged
merged 1 commit into from
Dec 15, 2022
Merged

Conversation

chinedufn
Copy link
Owner

This commit allows enums to use the already_declared attribute.

This is useful when you want to use the same enum across multiple bridge
modules.


For example, the following is now possible:

use some_other_bridge_module::SomeEnum;

#[swift_bridge::bridge]
mod ffi {
    #[swift_bridge(already_declared)]
    enum SomeEnum {}

    extern "Rust" {
        fn print(val: SomeEnum);
    }
}

This commit allows enums to use the `already_declared` attribute.

This is useful when you want to use the same enum across multiple bridge
modules.

---

For example, the following is now possible:

```rust
use some_other_bridge_module::SomeEnum;

#[swift_bridge::bridge]
mod ffi {
    #[swift_bridge(already_declared)]
    enum SomeEnum {}

    extern "Rust" {
        fn print(val: SomeEnum);
    }
}
```
@chinedufn chinedufn merged commit 72e1759 into master Dec 15, 2022
@chinedufn chinedufn deleted the already-declared-enum branch December 15, 2022 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant