durch / rust-s3

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

Make Read and Write generics friendlier to dynamic dispatch #380

Closed r-ml closed 1 week ago

r-ml commented 3 months ago

By relaxing size constraint. Avoid double indirection. Instead of having to pass &mut &mut dyn AsyncWrite, we can pass &mut dyn AsyncWrite, for example. The use case for dynamic dispatch is object-safe traits. Static dispatch is unaffected.

tokio and std do the same thing, for example tokio::io::copy and std::io::copy.

Example of the problem and desired outcome.

durch commented 1 week ago

@r-ml nice one! Thank you!