actix-net
actix-net copied to clipboard
actix-codec: Support Half streams
Right now the codec supports only IO that has both AsyncRead
and AsyncWrite
.
I have a situation where the incoming codec != outgoing codec (different messages and I'd like to distinguish).
Ideally, I could use TcpStream::split()
then create each half with a codec, but I can't do that because of both traits required.
I'm thinking we should add ReadFramed and WriteFramed to support that.
I'm also wondering if there is a specific reason that actix-codec is distinct from tokio-util::codec
I'm also wondering if there is a specific reason that actix-codec is distinct from tokio-util::codec
Ah! I didn't even notice it. TBH I solved it by creating 2 codecs, one for the "client" and other for the "server" which each one encodes/decodes different data.. not sure how elegant it is (prior solution was a generic codec)