Is it possible to wrap C enums in Rust?

Is it possible to wrap C enums in Rust?

For example, Example c enumeration

+6
source share
1 answer

Yes, no change (except spaces to fit the 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); } 

Print 1 10 14 .

+6
source

Source: https://habr.com/ru/post/956191/


All Articles