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 runtime asserts that validates the provided enums #23

Closed
emgre opened this issue Aug 31, 2020 · 2 comments
Closed

Add runtime asserts that validates the provided enums #23

emgre opened this issue Aug 31, 2020 · 2 comments
Labels
enhancement New feature or request gen-rust Rust generator issue

Comments

@emgre
Copy link
Contributor

emgre commented Aug 31, 2020

If a C library calls a Rust function with an unknown enum value, the behaviour is undefined. The Rust code generator should probably take enums as integer than check if the value fits with one of the enum variant. If it doesn't fit, it would pass None to our code.

Resources:

@emgre emgre added enhancement New feature or request gen-rust Rust generator issue labels Aug 31, 2020
@emgre
Copy link
Contributor Author

emgre commented Sep 4, 2020

Instead of an option, maybe only add a runtime assert that panics instead.

@emgre emgre changed the title Map FFI enums to Option<enum> Add runtime asserts that validates the provided enums Sep 17, 2020
@emgre
Copy link
Contributor Author

emgre commented Sep 25, 2020

Fixed in #28.

@emgre emgre closed this as completed Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gen-rust Rust generator issue
Projects
None yet
Development

No branches or pull requests

1 participant