How about `for byte in it.by_ref().take(nb) { wr.write_u8(byte) }`? (Or, even better, having `let it = it.by_ref();` outside the loop and using `it` directly.)