We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using an invalid valid as an enum causes the rust bindings to panic:
mypackage.UseFancyEnum(mypackage.FancyEnum(0))
causes Rust panic:
thread '<unnamed>' panicked at 'Failed to convert arg 'value': Invalid FancyEnum enum value: 0', [...].uniffi.rs:[...]
The text was updated successfully, but these errors were encountered:
With the use of a private interface should be able to avoid this, sth like this
package main import "fmt" type FooBarKind uint const ( FooKind FooBarKind = 0 BarKind FooBarKind = 1 ForgottenKind FooBarKind = 2 ) type Enum interface { enum } func (v FooBarKind) value() uint { return uint(v) } type enum interface { value() uint } func printEnum(val Enum) { fmt.Println("hello %v", val) } func main() { printEnum(FooKind) printEnum(3) // compile error cannot use 3 (constant of type int) as Enum value in argument to printEnum: int does not implement Enum (missing method value) }
Sorry, something went wrong.
No branches or pull requests
Using an invalid valid as an enum causes the rust bindings to panic:
causes Rust panic:
The text was updated successfully, but these errors were encountered: