use the 'Out' type in encode rather than copy/paste

This commit is contained in:
Patrick Barrett
2017-01-14 12:59:22 -06:00
parent d0833074d6
commit e502603532
+1 -3
View File
@@ -28,9 +28,7 @@ impl UdpCodec for LineCodec {
Ok((*addr, buf.to_vec()))
}
fn encode(&mut self,
(addr, buf): (SocketAddr, Vec<u8>),
into: &mut Vec<u8>) -> SocketAddr {
fn encode(&mut self, (addr, buf): Self::Out, into: &mut Vec<u8>) -> SocketAddr {
into.extend(buf);
return addr
}