durch / rust-s3

Rust library for interfacing with S3 API compatible services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use slices for multipart chunk data

dustinlagoy opened this issue · comments

Is your feature request related to a problem? Please describe.
When uploading large amounts of data I would like to avoid as many copies as possible. put_multipart_chunk currently requires moving a Vec<u8> as the input chunk which may require copying the chunk if it must be used elsewhere. Also this is different from put_object which uses &[u8] as the input.

Describe the solution you'd like
I would like put_multipart_chunk to accept a &[u8] slice as its input.

Describe alternatives you've considered
Refactoring my application to copy data or perform the put as the last step could work but seems unnecessary.

Additional context
Both put_multipart_chunk and put_object end up calling Command::PutObject with a slice and my cursory look at the source I didn't see any obvious reason moving was required for the putting chunks.

If this is something desired I would be happy to put a PR together.

commented

hey @dustinlagoy , why don't you submit the PR if you already have it? I believe it's super useful.