Skip to content

Instantly share code, notes, and snippets.

@kolmodin
Created June 8, 2013 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kolmodin/5734355 to your computer and use it in GitHub Desktop.
Save kolmodin/5734355 to your computer and use it in GitHub Desktop.
Rust code - type error.
fn getString(json: std::json::Json, key: ~str) -> Option<~str> {
match json {
std::json::Object(map) => {
match map.find(&key) {
Some(&std::json::String(str)) => Some(~"return str here"),
_ => None
}
},
_ => None
}
}
@kolmodin
Copy link
Author

kolmodin commented Jun 8, 2013

rust-json.rs:15:28: 15:32 error: by-move pattern bindings may not occur behind @ or & bindings
rust-json.rs:15 Some(&std::json::String(str)) => Some(~"return str here"),
^~~~
error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment