Skip to content

Commit

Permalink
Add docs for already declared enums
Browse files Browse the repository at this point in the history
  • Loading branch information
chinedufn committed Dec 15, 2022
1 parent 6d8cc84 commit d921eec
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion book/src/bridge-module/transparent-types/enums/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,27 @@ func create_bar_code(upc: Bool) -> BarCode {

### Enum Attributes

... TODO
#### #[swift_bridge::bridge(already_declared)]

```rust
#[swift_bridge::bridge]
mod ffi_1 {
enum SomeTransparentEnum {
Variant
}
}

use ffi_1::SomeTransparentEnum;

#[swift_bridge::bridge]
mod ffi_2 {
// The `already_declared` indicates that instead of creating a new enum
// we should use super::SomeTransparentEnum;
#[swift_bridge(already_declared)]
enum SomeTransparentEnum;

extern "Rust" {
fn some_function() -> SomeTransparentEnum;
}
}
```

0 comments on commit d921eec

Please sign in to comment.