From 268dab6ed36047b401f4d392fd27597321514e3a Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 29 Oct 2024 21:19:49 +0200 Subject: [PATCH] use clone of shared reference instead of ref --- src/gio/memory_input_stream.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gio/memory_input_stream.rs b/src/gio/memory_input_stream.rs index 7149df4..1c8d193 100644 --- a/src/gio/memory_input_stream.rs +++ b/src/gio/memory_input_stream.rs @@ -34,7 +34,7 @@ pub fn from_socket_connection_async( priority: Priority, bytes_in_chunk: usize, bytes_total_limit: usize, - on_chunk: impl Fn((&Bytes, &usize)) + 'static, + on_chunk: impl Fn((Bytes, usize)) + 'static, on_complete: impl FnOnce(Result)>) + 'static, ) { read_all_from_socket_connection_async( @@ -81,7 +81,7 @@ pub fn read_all_from_socket_connection_async( bytes_in_chunk: usize, bytes_total_limit: usize, bytes_total: usize, - on_chunk: impl Fn((&Bytes, &usize)) + 'static, + on_chunk: impl Fn((Bytes, usize)) + 'static, on_complete: impl FnOnce(Result)>) + 'static, ) { socket_connection.input_stream().read_bytes_async( @@ -94,7 +94,7 @@ pub fn read_all_from_socket_connection_async( let bytes_total = bytes_total + bytes.len(); // Callback chunk function - on_chunk((&bytes, &bytes_total)); + on_chunk((bytes.clone(), bytes_total)); // Validate max size if bytes_total > bytes_total_limit {