hyperlocal icon indicating copy to clipboard operation
hyperlocal copied to clipboard

Thoughts about making UnixStream public

Open Mythra opened this issue 3 years ago • 3 comments

👋 I'm looking at using this logic as part of my own HTTP Client, and I was hoping to get access to the UnixStream type: https://github.com/softprops/hyperlocal/blob/main/src/client.rs#L19.

The main reason i'm doing this all is to honestly have hyper tuned error reporting. Certain IO Error codes mean certain things depending on the stream type, and by wrapping everything in my own custom enums I can make decisions/keep state about the streams, connectors, etc. In any part of my codebase.

I realize most people get fine without it though, and I imagine it was made private for a reason, so I just wanted to see if there was any chance we could start exporting that type.

Mythra avatar Jul 14 '21 22:07 Mythra

The choice to keep the inner UnixStream private seems to match what hyper does with AddrStream: reference. Though the latter type does have an into_inner to get the backing TcpStream, it would not be usable in a MakeServiceRef implementor. Your application could certainly be doing something else... Is this a capability that you are currently using with AddrStream (or similar)? UnixStream could probably implement into_inner, if so.

@fnichol Just in case.

onalante-msft avatar Jan 11 '22 19:01 onalante-msft

hyper does not expose the inner TcpStream, but the AddrStream itself is exposed in the public interface? For my use case, I wrap UnixConnector and UnixStream into my own enum types together with other connectors / streams. I would think it is quite common to support both unix and other uris in one hyper client?

yu-re-ka avatar Jul 04 '22 10:07 yu-re-ka

Oh, I completely missed that UnixStream was not exported from lib.rs. My sincere apologies about that! I should have looked more closely at the export declarations.

I agree that making UnixStream public would be most consistent with hyper.

@softprops Would you like to delegate maintenance of this project to help manage some of the outstanding PRs?

onalante-msft avatar Aug 13 '22 15:08 onalante-msft