Skip to main content

Transport

Trait Transport 

Source
pub trait Transport {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn request(
        &self,
        method: &str,
        path: &str,
        query: &[(&str, String)],
        body: Option<Vec<u8>>,
    ) -> impl Future<Output = Result<(u16, Vec<u8>), Self::Error>> + Send;
}
Expand description

What a generated method issues its request through.

It is declared here rather than imported: the half of this crate that reaches the network is hand-written and implements it, so neither half has to name what the other declares, and nothing here carries a socket.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

What this transport reports when it could not reach the API at all.

Required Methods§

Source

fn request( &self, method: &str, path: &str, query: &[(&str, String)], body: Option<Vec<u8>>, ) -> impl Future<Output = Result<(u16, Vec<u8>), Self::Error>> + Send

Issues one request, answering the status the API replied with and the body it sent.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§