-
I have an enum like this: use tokio::{io::WriteHalf, net::{tcp::OwnedWriteHalf, TcpStream}};
use tokio_rustls::server::TlsStream;
#[derive(Debug)]
pub enum TcpWriter {
TcpWriter(OwnedWriteHalf),
TlsTcpWriter(WriteHalf<TlsStream<TcpStream>>),
} I want to implement AsyncWrite for it: use tokio::io::AsyncWrite;
impl AsyncWrite for TcpWriter {
// TODO
} Is it possible? What should I do? |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Jul 26, 2021
Replies: 1 comment 1 reply
-
An enum like this is available as |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Darksonn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An enum like this is available as
tokio_util::either::Either
. You can find the source intokio-util/src/either.rs
.