Skip to content

Commit

Permalink
Remove clone in message split method
Browse files Browse the repository at this point in the history
Now split method use owned self, not reference.
  • Loading branch information
AbstractiveNord authored and Jarema committed Dec 7, 2023
1 parent f43460d commit 42bc64f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions async-nats/src/jetstream/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::Error;
use bytes::Bytes;
use futures::future::TryFutureExt;
use futures::StreamExt;
use std::time::Duration;
use std::{mem, time::Duration};
use time::OffsetDateTime;

#[derive(Clone, Debug)]
Expand All @@ -45,8 +45,8 @@ impl Message {
/// Splits [Message] into [Acker] and [crate::Message].
/// This can help reduce memory footprint if [Message] can be dropped before acking,
/// for example when it's transformed into another structure and acked later
pub fn split(self) -> (crate::Message, Acker) {
let reply = self.message.reply.clone();
pub fn split(mut self) -> (crate::Message, Acker) {
let reply = mem::take(&mut self.message.reply);
(
self.message,
Acker {
Expand Down

0 comments on commit 42bc64f

Please sign in to comment.