我想知道是否有可能解码Rust中的JSON对象,该对象的属性名也是Rust关键字.我正在使用rustc serialize crate ,我的 struct 定义如下所示:
#[derive(RustcDecodable)]
struct MyObj {
type: String
}
编译器抛出错误,因为type是关键字.确切的编译器错误消息是:
error: expected identifier, found keyword `type`
src/mysrc.rs:23 type: String,
^~~~
抱歉,我刚开始try Rust .