1
Fork 0

Fix build errors.

This commit is contained in:
Alex Helfet 2020-01-28 23:16:04 +00:00
parent 7aa8d3fd3c
commit cb76e71b90
2 changed files with 8 additions and 8 deletions

View file

@ -336,7 +336,7 @@ impl Codec {
/// Reads bytes from the supplied `Read` until it has a complete /// Reads bytes from the supplied `Read` until it has a complete
/// encoded frame, then decodes the frame, returning the payload on the heap. /// encoded frame, then decodes the frame, returning the payload on the heap.
#[cfg(feature = "use_std")] #[cfg(feature = "use_std")]
pub fn decode_from_reader<R: Read>(&mut self, r: &mut Read) pub fn decode_from_reader<R: Read>(&mut self, r: &mut dyn Read)
-> Result<BoxPayload> { -> Result<BoxPayload> {
// Read until FRAME_END_SYMBOL // Read until FRAME_END_SYMBOL
let mut next_frame = Vec::new(); let mut next_frame = Vec::new();
@ -544,7 +544,7 @@ mod tests {
#[test] #[test]
#[should_panic] #[should_panic]
fn encode_to_slice_dest_too_small() { fn encode_to_slice_dest_too_small() {
let mut encoded_buf = [0u8; PAYLOAD_LEN];; let mut encoded_buf = [0u8; PAYLOAD_LEN];
let _ = codec().encode_to_slice(&PAYLOAD, &mut encoded_buf); let _ = codec().encode_to_slice(&PAYLOAD, &mut encoded_buf);
} }
@ -810,11 +810,11 @@ mod rw_tests {
Config::default() Config::default()
} }
fn pair() -> (Sender<Box<Write>>, Receiver<Box<Read>>) { fn pair() -> (Sender<Box<dyn Write>>, Receiver<Box<dyn Read>>) {
let chan = Channel::new(); let chan = Channel::new();
let c = config(); let c = config();
let tx = c.clone().to_sender(Box::new(chan.writer()) as Box<Write>); let tx = c.clone().to_sender(Box::new(chan.writer()) as Box<dyn Write>);
let rx = c.clone().to_receiver(Box::new(chan.reader()) as Box<Read>); let rx = c.clone().to_receiver(Box::new(chan.reader()) as Box<dyn Read>);
(tx, rx) (tx, rx)
} }
} }

View file

@ -488,13 +488,13 @@ mod tests {
} }
} }
fn pair() -> (Sender<Box<Write>, Test>, Receiver<Box<Read>, Test>) { fn pair() -> (Sender<Box<dyn Write>, Test>, Receiver<Box<dyn Read>, Test>) {
let chan = Channel::new(); let chan = Channel::new();
let conf = bytes::Config::default().typed::<Test>(); let conf = bytes::Config::default().typed::<Test>();
let tx = conf.clone() let tx = conf.clone()
.to_sender(Box::new(chan.writer()) as Box<Write>); .to_sender(Box::new(chan.writer()) as Box<dyn Write>);
let rx = conf.clone() let rx = conf.clone()
.to_receiver(Box::new(chan.reader()) as Box<Read>); .to_receiver(Box::new(chan.reader()) as Box<dyn Read>);
(tx, rx) (tx, rx)
} }
} }