Y
Hacker News
new
|
ask
|
show
|
jobs
by
justmedep
29 days ago
That’s just a very bad API. You could do the same in Rust? There are nice C APIs that would use a nice struct that describes the timeout you want… eg GCD.
1 comments
eru
29 days ago
I'm not sure a struct is the right thing here in general. You often want an algebraic datatype.
What Rust calls an enum, but an enum with payloads. In C terms it would be a discriminated union.
link
What Rust calls an enum, but an enum with payloads. In C terms it would be a discriminated union.