나는 여분 (another) : json 모듈뿐만 아니라 녹 (Rust)을 배우고 있습니다.는 역 참조를 벗어날 수 없습니다
$ rust run json.rs
json.rs:70:9: 70:18 error: cannot move out of dereference of & pointer
json.rs:70 &Object(o) => {
^~~~~~~~~
note: in expansion of fmt!
json.rs:68:10: 79:6 note: expansion site
error: aborting due to previous error
나는이 오류를 때리지 마세요 일치를 사용 other examples이 : 내가 컴파일 할 때
let j:Result<Json,JsonError> = from_str("[{\"bar\":\"baz\", \"biz\":123}]");
let l:List = match j {
Ok(List(l)) => l,
Ok(_) => fail!("Expected a list at the top level"),
Err(e) => fail!(fmt!("Error: %?", e))
};
println(fmt!("item = %?", l.iter().advance(|i|{
match i {
&Object(o) => {
println(fmt!("Object is %?", o));
},
_ => {
fail!("Should be a list of objects, no?");
}
}
println(fmt!("i=%?", i));
true
})));
, 나는이 얻을 : 여기에 (추가 unneeed 형 주석) 내 예입니다.
도움 주셔서 감사합니다.
감사를 표시해야합니다. – Ozten