Skip to main content

Client

Trait Client 

Source
pub trait Client: Debug {
    // Required methods
    fn get(
        &self,
        url: &Url,
        params: &[(&str, &str)],
    ) -> impl Future<Output = Result<(u16, Arc<String>), ClientError>>;
    fn get_bin(
        &self,
        url: &Url,
        params: &[(&str, &str)],
    ) -> impl Future<Output = Result<(u16, Arc<Vec<u8>>), ClientError>>;
}
Expand description

Backend client implementation trait

This trait needs to be implemented by clients to be used by auditors, monitors etc.

Required Methods§

Source

fn get( &self, url: &Url, params: &[(&str, &str)], ) -> impl Future<Output = Result<(u16, Arc<String>), ClientError>>

Make a GET request to fetch some String data

§Arguments
  • url: the Url to connect to
  • params: Key-value pairs of query parameters to be included in the request
§Returns
  • On success:
    • The HTTP status code
    • The data as a String
  • On failure: The ClientError describing what went wrong
Source

fn get_bin( &self, url: &Url, params: &[(&str, &str)], ) -> impl Future<Output = Result<(u16, Arc<Vec<u8>>), ClientError>>

Make a GET request to fetch some binary data

§Arguments
  • url: the Url to connect to
  • params: Key-value pairs of query parameters to be included in the request
§Returns
  • On success:
    • The HTTP status code
    • The data as a Vec<u8>
  • On failure: The ClientError describing what went wrong

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§