You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix already_declared attribute for enums and structs (#226)
When generating the rust function wrappers for an extern swift function with an already_declared struct/enum the generated code used a locally defined struct/enum with this patch we add `super` to that function signature.
An example of code that was previously not working:
```rs
#[swift_bridge::bridge]
mod ffi_i {
enum Foo {
Bar.
}
}
use ffi_i::Foo;
#[swift_bridge::bridge]
mod ffi {
#[swift_bridge(already_declared)]
enum Foo {}
extern "Rust" {}
extern "Swift" {
fn baz(a: Foo);
}
}
```
Previously the genrated function would be something like:
```rs
mod ffi {
fn baz(a: Foo) {
// ...
}
}
```
now it's
```rs
mod ffi {
fn baz(a: super::Foo) {
// ...
}
}
```
0 commit comments