use reference without copy usize

This commit is contained in:
yggverse 2024-10-29 16:33:32 +02:00
parent 02ced24cce
commit 4ab83702e9

View file

@ -34,7 +34,7 @@ pub fn from_socket_connection_async(
priority: Priority, priority: Priority,
bytes_in_chunk: usize, bytes_in_chunk: usize,
bytes_total_limit: usize, bytes_total_limit: usize,
on_chunk: Option<impl Fn((&Bytes, usize)) + 'static>, on_chunk: Option<impl Fn((&Bytes, &usize)) + 'static>,
on_complete: Option<impl FnOnce(Result<MemoryInputStream, (Error, Option<&str>)>) + 'static>, on_complete: Option<impl FnOnce(Result<MemoryInputStream, (Error, Option<&str>)>) + 'static>,
) { ) {
read_all_from_socket_connection_async( read_all_from_socket_connection_async(
@ -82,7 +82,7 @@ pub fn read_all_from_socket_connection_async(
bytes_in_chunk: usize, bytes_in_chunk: usize,
bytes_total_limit: usize, bytes_total_limit: usize,
bytes_total: usize, bytes_total: usize,
on_chunk: Option<impl Fn((&Bytes, usize)) + 'static>, on_chunk: Option<impl Fn((&Bytes, &usize)) + 'static>,
on_complete: Option<impl FnOnce(Result<MemoryInputStream, (Error, Option<&str>)>) + 'static>, on_complete: Option<impl FnOnce(Result<MemoryInputStream, (Error, Option<&str>)>) + 'static>,
) { ) {
socket_connection.input_stream().read_bytes_async( socket_connection.input_stream().read_bytes_async(
@ -96,7 +96,7 @@ pub fn read_all_from_socket_connection_async(
// Callback chunk function // Callback chunk function
if let Some(ref callback) = on_chunk { if let Some(ref callback) = on_chunk {
callback((&bytes, bytes_total)); callback((&bytes, &bytes_total));
} }
// Validate max size // Validate max size