Skip to content

Commit

Permalink
Reuse the same vec during copies
Browse files Browse the repository at this point in the history
sfackler committed Oct 28, 2014
1 parent 5dd09ce commit 4a9ca42
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1666,11 +1666,13 @@ impl<'a> PostgresCopyInStatement<'a> {
}
}

let mut data = buf.unwrap();
try_pg_desync!(conn, conn.stream.write_message(
&CopyData {
data: buf.unwrap()[]
data: data[]
}));
buf = MemWriter::new();
data.clear();
buf = MemWriter::from_vec(data);
}

let _ = buf.write_be_i16(-1);

0 comments on commit 4a9ca42

Please sign in to comment.