I was wondering if it is possible to decode a JSON object in Rust that has an attribute name which is also a Rust keyword. I am working with the rustc-serialize
crate and my struct definition looks like this:
#[derive(RustcDecodable)]
struct MyObj {
type: String
}
The compiler throws an error because type
is a keyword:
error: expected identifier, found keyword `type`
src/mysrc.rs:23 type: String,
^~~~
impl Decodable
is the only way? – BergemanJson::from_str
and then poking into its result value. – Greggs