Skip to content

Commit d104e2e

Browse files
committed
make PgCopyBoth cloneable (it's all Arc under the hood)
Also remove an unecessary mut
1 parent dd365d5 commit d104e2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sqlx-postgres/src/copy.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ enum PgCopyBothCommand {
373373
CopyDone { from_client: bool },
374374
}
375375

376+
#[derive(Clone)]
376377
pub struct PgCopyBoth {
377378
recv_stream: flume::r#async::RecvStream<'static, Result<Bytes>>,
378379
send_tx: flume::Sender<PgCopyBothCommand>,
@@ -441,7 +442,7 @@ impl PgCopyBoth {
441442
}
442443

443444
/// Send a chunk of `COPY` data.
444-
pub async fn send(&mut self, data: impl Into<Vec<u8>>) -> Result<()> {
445+
pub async fn send(&self, data: impl Into<Vec<u8>>) -> Result<()> {
445446
self.send_tx
446447
.send_async(PgCopyBothCommand::CopyData(data.into()))
447448
.await

0 commit comments

Comments
 (0)