mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
return bytes total on_complete
This commit is contained in:
parent
f33e53e51b
commit
1911b0ad95
2 changed files with 7 additions and 7 deletions
|
|
@ -21,8 +21,8 @@ pub fn move_all_from_stream_async(
|
|||
usize, // bytes_total
|
||||
),
|
||||
callback: (
|
||||
impl Fn(Bytes, usize) + 'static, // on_chunk
|
||||
impl FnOnce(Result<FileOutputStream, Error>) + 'static, // on_complete
|
||||
impl Fn(Bytes, usize) + 'static, // on_chunk
|
||||
impl FnOnce(Result<(FileOutputStream, usize), Error>) + 'static, // on_complete
|
||||
),
|
||||
) {
|
||||
let (on_chunk, on_complete) = callback;
|
||||
|
|
@ -49,7 +49,7 @@ pub fn move_all_from_stream_async(
|
|||
|
||||
// No bytes were read, end of stream
|
||||
if bytes.len() == 0 {
|
||||
return on_complete(Ok(file_output_stream));
|
||||
return on_complete(Ok((file_output_stream, bytes_total)));
|
||||
}
|
||||
|
||||
// Write chunk bytes
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ pub fn from_stream_async(
|
|||
bytes_in_chunk: usize,
|
||||
bytes_total_limit: usize,
|
||||
on_chunk: impl Fn(Bytes, usize) + 'static,
|
||||
on_complete: impl FnOnce(Result<MemoryInputStream, Error>) + 'static,
|
||||
on_complete: impl FnOnce(Result<(MemoryInputStream, usize), Error>) + 'static,
|
||||
) {
|
||||
move_all_from_stream_async(
|
||||
base_io_stream,
|
||||
|
|
@ -46,8 +46,8 @@ pub fn move_all_from_stream_async(
|
|||
usize, // bytes_total
|
||||
),
|
||||
callback: (
|
||||
impl Fn(Bytes, usize) + 'static, // on_chunk
|
||||
impl FnOnce(Result<MemoryInputStream, Error>) + 'static, // on_complete
|
||||
impl Fn(Bytes, usize) + 'static, // on_chunk
|
||||
impl FnOnce(Result<(MemoryInputStream, usize), Error>) + 'static, // on_complete
|
||||
),
|
||||
) {
|
||||
let (on_chunk, on_complete) = callback;
|
||||
|
|
@ -72,7 +72,7 @@ pub fn move_all_from_stream_async(
|
|||
|
||||
// No bytes were read, end of stream
|
||||
if bytes.len() == 0 {
|
||||
return on_complete(Ok(memory_input_stream));
|
||||
return on_complete(Ok((memory_input_stream, bytes_total)));
|
||||
}
|
||||
|
||||
// Write chunk bytes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue