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§
source§impl<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.
source§impl<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<BString>) -> Self
pub fn custom_url(self, url: Option<BString>) -> 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§
source§impl<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.source§impl<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.source§fn 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().source§fn to_url(&self) -> Cow<'_, BStr>
fn to_url(&self) -> Cow<'_, BStr>
source§fn connection_persists_across_multiple_requests(&self) -> bool
fn connection_persists_across_multiple_requests(&self) -> bool
source§fn configure(
&mut self,
_config: &dyn Any
) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
fn configure( &mut self, _config: &dyn Any ) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
config can be cast and interpreted by the implementation, as documented separately. Read more