-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to generate safe and unsafe conversions for rustified enums
- Loading branch information
Showing
9 changed files
with
603 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
bindgen-tests/tests/expectations/tests/libclang-9/struct_typedef_ns.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// bindgen-flags: --rustified-enum 'Plain.*' --rustified-enum 'TryFromRaw.*=try_from_raw' --rustified-enum='FromRawUnchecked.*=from_raw_unchecked' --rustified-enum='Both.*=try_from_raw,from_raw_unchecked' --rustified-enum 'NonExhaustive.*=non_exhaustive' | ||
|
||
enum Plain { | ||
Plain1, | ||
Plain2, | ||
Plain3 | ||
}; | ||
|
||
enum TryFromRaw { | ||
TFR1 = -1, | ||
TFR2 = 5, | ||
TFR3 | ||
}; | ||
|
||
enum FromRawUnchecked { | ||
FRU1 = 6, | ||
FRU2 = 10, | ||
FRU3 = 11, | ||
}; | ||
|
||
enum Both { | ||
Both1, | ||
Both2 = -1, | ||
Both3, | ||
}; | ||
|
||
enum NonExhaustive { | ||
Ex1, | ||
Ex2, | ||
}; |
Oops, something went wrong.