Struct gix_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>
impl<R, W> Connection<R, W>
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,
trace: bool
) -> 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, trace: bool ) -> 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.
If trace
is true
, all packetlines received or sent will be passed to the facilities of the gix-trace
crate.
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>
Available on crate feature blocking-client
only.
impl<R, W> Transport for Connection<R, W>
blocking-client
only.source§impl<R, W> TransportWithoutIO for Connection<R, W>
Available on crate feature blocking-client
only.
impl<R, W> TransportWithoutIO for Connection<R, W>
blocking-client
only.source§fn request(
&mut self,
write_mode: WriteMode,
on_into_read: MessageKind,
trace: bool
) -> Result<RequestWriter<'_>, Error>
fn request( &mut self, write_mode: WriteMode, on_into_read: MessageKind, trace: bool ) -> 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()
.
If trace
is true
, then all packetlines written and received will be traced using facilities provided by the gix_trace
crate.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 moresource§fn set_identity(&mut self, _identity: Account) -> Result<(), Error>
fn set_identity(&mut self, _identity: Account) -> Result<(), Error>
std::io::ErrorKind::PermissionDenied
, use this method to
inform the transport layer about the identity to use for subsequent calls.
If authentication continues to fail even with an identity set, consider communicating this to the provider
of the identity in order to mark it as invalid. Otherwise the user might have difficulty updating obsolete
credentials.
Please note that most transport layers are unauthenticated and thus return an error here.source§fn supported_protocol_versions(&self) -> &[Protocol]
fn supported_protocol_versions(&self) -> &[Protocol]
Auto Trait Implementations§
impl<R, W> Freeze for Connection<R, W>
impl<R, W> RefUnwindSafe for Connection<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for Connection<R, W>
impl<R, W> Sync for Connection<R, W>
impl<R, W> Unpin for Connection<R, W>
impl<R, W> UnwindSafe for Connection<R, W>where
R: UnwindSafe,
W: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> TransportV2Ext for Twhere
T: Transport,
impl<T> TransportV2Ext for Twhere
T: Transport,
source§fn invoke<'a>(
&mut self,
command: &str,
capabilities: impl Iterator<Item = (&'a str, Option<impl AsRef<str>>)> + 'a,
arguments: Option<impl Iterator<Item = BString>>,
trace: bool
) -> Result<Box<dyn ExtendedBufRead<'_> + Unpin + '_>, Error>
fn invoke<'a>( &mut self, command: &str, capabilities: impl Iterator<Item = (&'a str, Option<impl AsRef<str>>)> + 'a, arguments: Option<impl Iterator<Item = BString>>, trace: bool ) -> Result<Box<dyn ExtendedBufRead<'_> + Unpin + '_>, Error>
blocking-client
only.command
with given capabilities
and optional command specific arguments
.
The capabilities
were communicated during the handshake.
If trace
is true
, then all packetlines written and received will be traced using facilities provided by the gix_trace
crate. Read more