error[E0225]: only auto traits can be used as additional traits in a trait object
--> examples/async_transporter.rs:60:33
|
60 | stream: Arc<dyn AsyncRead + AsyncWrite>,
| --------- ^^^^^^^^^^ additional non-auto trait
| |
| first non-auto trait
|
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: tokio::io::AsyncRead + tokio::io::AsyncWrite {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
An object like this would be pretty useless because the AsyncRead/AsyncWrite traits require mutable access in order to use them, but an Arc provides only immutable access.
Maybe you can explain what you are trying to accomplish with this? Perhaps tokio::io::split would be useful for you?
I implemented AsyncRead and AsyncWrite for a custom socket I have. I want to use this socket into this custom transporter. it should be just a matter of doing