Is it possible to wrap C enums in Rust?
For example C enum example
Yes, with no changes (other than whitespace to fit in with prevailing Rust style):
enum List {
MaxLogLevel = 1,
MaxNumMessages,
TrilinearFiltering,
MaxAnisotropy,
TexCompression,
SRGBLinearization,
LoadTextures,
FastAnimation,
ShadowMapSize,
SampleCount,
WireframeMode,
DebugViewMode,
DumpFailedShaders,
GatherTimeStats
}
fn main() {
println!("{} {} {}",
MaxLogLevel as uint,
SampleCount as uint,
GatherTimeStats as uint);
}
Prints 1 10 14
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With