pub trait Transport: TransportWithoutIO {
    // Required method
    fn handshake<'a>(
        &mut self,
        service: Service,
        extra_parameters: &'a [(&'a str, Option<&'a str>)]
    ) -> Result<SetServiceResponse<'_>, Error>;
}
Available on crate feature blocking-client only.
Expand description

All methods provided here must be called in the correct order according to the communication protocol used to connect to them. It does, however, know just enough to be able to provide a higher-level interface than would otherwise be possible. Thus the consumer of this trait will not have to deal with packet lines at all. Note that whenever a Read trait or Write trait is produced, it must be exhausted.

Required Methods§

source

fn handshake<'a>( &mut self, service: Service, extra_parameters: &'a [(&'a str, Option<&'a str>)] ) -> Result<SetServiceResponse<'_>, Error>

Initiate connection to the given service and send the given extra_parameters along with it.

extra_parameters are interpreted as key=value pairs if the second parameter is Some or as key if it is None.

Returns the service capabilities according according to the actual Protocol it supports, and possibly a list of refs to be obtained. This means that asking for an unsupported protocol might result in a protocol downgrade to the given one if TransportWithoutIO::supported_protocol_versions() includes it. Exhaust the returned BufReader for a list of references in case of protocol V1 before making another request.

Implementations on Foreign Types§

source§

impl<T: Transport + ?Sized> Transport for &mut T

source§

fn handshake<'a>( &mut self, service: Service, extra_parameters: &'a [(&'a str, Option<&'a str>)] ) -> Result<SetServiceResponse<'_>, Error>

source§

impl<T: Transport + ?Sized> Transport for Box<T>

source§

fn handshake<'a>( &mut self, service: Service, extra_parameters: &'a [(&'a str, Option<&'a str>)] ) -> Result<SetServiceResponse<'_>, Error>

Implementors§

source§

impl Transport for SpawnProcessOnDemand

source§

impl<H: Http> Transport for Transport<H>

Available on crate feature http-client only.
source§

impl<R, W> Transport for Connection<R, W>
where R: Read, W: Write,

Available on crate features blocking-client or async-client only.