You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There would be benefits to not boxing the connectors
In the connector traits, the transports are boxed, preventing chained connectors to make use of specificities of the previous transport. Ideally for example, it would be possible to use the specific type of the previous transport. For example a TCP keepalive connector could just wrap or come after a TcpTransport, get its TCP stream, and enable Keepalive on it.
The way I would do it would use associated types for the transports, and make chained and not chained connectors part of the trait.
This type safety would allow for example a keepalive connector, which is much simpler that re-implementing all the functionality of the TcpConnector just to add that. It makes connectors much more composable.
structKeepaliveConnector;implMiddleConnector<TcpTransport>forKeepaliveConnector{typeTransport = TcpTransport;fnconnect(&self,details:&ConnectionDetails,chained:TcpTransport,) -> Result<Self::Transport,Error>{let stream:&std::net::TcpStream = chained.tcp_stream();// Configure Keepalive on the TcpStream;Ok(chained)}}
The text was updated successfully, but these errors were encountered:
Maybe it should just be made #[doc(hidden)], and have another crate that depends on a specific version of ureq (with =3.1.0 for example), and re-exports the items of this module. That way breaking changes in ureq are possible, and this ureq-transports? crate can have more frequent semver bumps.
Quoting @sosthene-nitrokey in #870:
The text was updated successfully, but these errors were encountered: