Can also use the double ref trick:
io::copy(&mut &stream, &mut &stream)
as &TcpStream is also Write and Read.
Each &stream is actually a different value, so each mut ref is for a different value, and thus no borrow checker violation.
Share this highlighthttp://www.safaribooksonline.com/a/programming-rust/12622649/