Created
December 23, 2016 13:49
-
-
Save allengeorge/17eb325c14acccf6ae62195457a21bef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn write_bool(&mut self, b: bool) -> ::Result<()> { | |
match self.pending_write_bool_field_identifier { | |
Some(pending) => { | |
let field_id = pending.id.expect("bool field should have a field id"); | |
let field_type_as_u8 = if b { | |
0x01 | |
} else { | |
0x02 | |
}; | |
try!(self.write_field_header(field_type_as_u8, field_id)); | |
Ok(()) | |
}, | |
None => { | |
if b { | |
self.write_byte(0x01) | |
} else { | |
self.write_byte(0x02) | |
} | |
} | |
} | |
} | |
/* | |
Compiling rift v0.2.0 (file:///Users/allen/src/rust_projects/thrift/lib/rs) | |
error[E0507]: cannot move out of borrowed content | |
--> src/protocol/compact.rs:190:15 | |
| | |
190 | match self.pending_write_bool_field_identifier { | |
| ^^^^ cannot move out of borrowed content | |
191 | Some(pending) => { | |
| ------- hint: to prevent move, use `ref pending` or `ref mut pending` | |
error: aborting due to previous error | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment