Trait xmlrpc::Transport[][src]

pub trait Transport {
    type Stream: Read;
    fn transmit(
        self,
        request: &Request<'_>
    ) -> Result<Self::Stream, Box<dyn Error + Send + Sync>>; }
Expand description

Request and response transport abstraction.

The Transport trait provides a way to send a Request to a server and to receive the corresponding response. A Transport implementor is passed to Request::call in order to use it to perform that request.

The most commonly used transport is simple HTTP: If the http feature is enabled (it is by default), the reqwest RequestBuilder will implement this trait and send the XML-RPC Request via HTTP.

You can implement this trait for your own types if you want to customize how requests are sent. You can modify HTTP headers or wrap requests in a completely different protocol.

Associated Types

The response stream returned by transmit.

Required methods

Transmits an XML-RPC request and returns the server’s response.

The response is returned as a Self::Stream - some type implementing the Read trait. The library will read all of the data and parse it as a response. It must be UTF-8 encoded XML, otherwise the call will fail.

Errors

If a transport error occurs, it should be returned as a boxed error - the library will then return an appropriate Error to the caller.

Implementations on Foreign Types

Use a RequestBuilder as the transport.

The request will be sent as specified in the XML-RPC specification: A default User-Agent will be set, along with the correct Content-Type and Content-Length.

Implementors