Closed r-ml closed 1 week 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.
&mut &mut dyn AsyncWrite
&mut dyn AsyncWrite
tokio and std do the same thing, for example tokio::io::copy and std::io::copy.
tokio
std
Example of the problem and desired outcome.
@r-ml nice one! Thank you!
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
andstd
do the same thing, for example tokio::io::copy and std::io::copy.Example of the problem and desired outcome.