Replies: 1 comment 2 replies
-
Thanks so much for sharing, here is my thoughts.
Great catch, I also think that should be possible. This should be an adequate fix: fn handshake(&mut self, service: Service, params: impl Iterator<Item = &'a str>) -> Result<SetServiceResponse<'_>, Error>;
If you operate on transport level you would be driving it and thus can already abort at will by closing the connection. Thus I assume this should be possible when using the When using
I would love to allow Ok(git::Connection::new(
read,
write,
desired_version,
path,
None::<(String, _)>,
git::ConnectMode::Daemon,
)
.set_stateful(false)
.set_url("foobar"))
If you think my suggestions could work I am happy to implement them, these are a quick-fixes to me. I couldn't find the code you were writing but seeing it might help to make even better APIs :). |
Beta Was this translation helpful? Give feedback.
-
It turns out that I needed to define my own
Transport
impl, because:to_url
andis_stateful
methods are used, but morally they need to return different things than the defaultConnection
for my caseTo do that, I needed to make the capabilities parsing public. While that is probably always needed for custom transports, I’m wondering if the interface could be generalised such that more use cases can just reuse a parametric
Connection
. For example, the delegate pattern could be employed for the handshake, and extra parameters could be stored inConnection
.I’d be happy to propose a patch, but wanted to gauge first if there’s interest, or maybe different plans already.
Beta Was this translation helpful? Give feedback.
All reactions