Created
November 18, 2016 03:21
-
-
Save allengeorge/715bee85d551bb0e7f7978a0f76a5793 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
pub struct TBinaryProtocol { | |
/// Set to `true` if the strict binary protocol is to be used. | |
pub strict: bool, | |
/// Underlying transport used to read protocol bytes from, and write protocol bytes to. | |
pub transport: Rc<RefCell<Box<TTransport>>>, | |
} | |
#[test] | |
fn must_write_correct_strict_call_message_header() { | |
let mut t = Rc::new(RefCell::new(Box::new(TMemBufferTransport::with_capacity(10, 10)))); | |
let mut b = TBinaryProtocol { strict: true, transport: t.clone() }; | |
let message_ident = TMessageIdentifier { name: "test".to_owned(), message_type: TMessageType::Call, sequence_number: 0 }; | |
assert!(b.write_message_begin(&message_ident).is_ok()); | |
let b = t.borrow_mut().read_buffer(); | |
} | |
/* | |
error[E0308]: mismatched types | |
--> src/protocol/binary.rs:336:64 | |
| | |
336 | let mut b = TBinaryProtocol { strict: true, transport: t.clone() }; | |
| ^^^^^^^^^ expected trait transport::TTransport, found struct `transport::membuffer::TMemBufferTransport` | |
| | |
= note: expected type `std::rc::Rc<std::cell::RefCell<Box<transport::TTransport + 'static>>>` | |
= note: found type `std::rc::Rc<std::cell::RefCell<Box<transport::membuffer::TMemBufferTransport>>>` | |
error: aborting due to previous error | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment