是否可以在Rust中包装C枚举?
答案 0 :(得分:6)
是的,没有任何变化(除了空白以适应普遍的Rust风格):
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);
}
打印1 10 14
。