durch / rust-s3

Rust library for interfacing with S3 API compatible services
MIT License
498 stars 195 forks source link

Use slices for multipart chunk data #351

Open dustinlagoy opened 1 year ago

dustinlagoy commented 1 year ago

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.

garikello3d commented 2 months ago

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