是否有可能换ç枚举鲁斯特? [英] Is it possible to wrap C enums in Rust?

查看:148
本文介绍了是否有可能换ç枚举鲁斯特?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能换ç枚举鲁斯特?

Is it possible to wrap C enums in Rust?

例如Ç枚举的例子

推荐答案

是的,没有任何变化(除空白,以配合prevailing锈风格):

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);
}

打印 1 10 14

这篇关于是否有可能换ç枚举鲁斯特?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆