Struct git_transport::client::git::Connection
source · [−]pub struct Connection<R, W> { /* private fields */ }blocking-client or async-client only.Expand description
A TCP connection to either a git daemon or a spawned git process.
When connecting to a daemon, additional context information is sent with the first line of the handshake. Otherwise that
context is passed using command line arguments to a spawned git process.
Implementations
sourceimpl<R, W> Connection<R, W>where
R: Read,
W: Write,
impl<R, W> Connection<R, W>where
R: Read,
W: Write,
sourcepub fn new(
read: R,
write: W,
desired_version: Protocol,
repository_path: impl Into<BString>,
virtual_host: Option<(impl Into<String>, Option<u16>)>,
mode: ConnectMode
) -> Self
Available on crate feature blocking-client only.
pub fn new(
read: R,
write: W,
desired_version: Protocol,
repository_path: impl Into<BString>,
virtual_host: Option<(impl Into<String>, Option<u16>)>,
mode: ConnectMode
) -> Self
blocking-client only.Create a connection from the given read and write, asking for desired_version as preferred protocol
and the transfer of the repository at repository_path.
virtual_host along with a port to which to connect to, while mode determines the kind of endpoint to connect to.
sourceimpl<R, W> Connection<R, W>
impl<R, W> Connection<R, W>
sourcepub fn into_inner(self) -> (R, W)
pub fn into_inner(self) -> (R, W)
Return the inner reader and writer
sourcepub fn custom_url(self, url: Option<String>) -> Self
pub fn custom_url(self, url: Option<String>) -> Self
Optionally set the URL to be returned when asked for it if Some or calculate a default for None.
The URL is required as parameter for authentication helpers which are called in transports that support authentication. Even though plain git transports don’t support that, this may well be the case in custom transports.
Trait Implementations
sourceimpl<R, W> Transport for Connection<R, W>where
R: Read,
W: Write,
Available on crate feature blocking-client only.
impl<R, W> Transport for Connection<R, W>where
R: Read,
W: Write,
blocking-client only.sourceimpl<R, W> TransportWithoutIO for Connection<R, W>where
R: Read,
W: Write,
Available on crate feature blocking-client only.
impl<R, W> TransportWithoutIO for Connection<R, W>where
R: Read,
W: Write,
blocking-client only.sourcefn supported_protocol_versions(&self) -> &[Protocol]
fn supported_protocol_versions(&self) -> &[Protocol]
We implement this in a paranoid and safe way, not allowing downgrade to V1 which could send large amounts of refs in case we didn’t want to support V1.
sourcefn request(
&mut self,
write_mode: WriteMode,
on_into_read: MessageKind
) -> Result<RequestWriter<'_>, Error>
fn request(
&mut self,
write_mode: WriteMode,
on_into_read: MessageKind
) -> Result<RequestWriter<'_>, Error>
write_mode determines how calls to the write(…) method are interpreted, and on_into_read determines
which message to write when the writer is turned into the response reader using into_read(). Read more