Skip to main content

BlockingIpApi

Trait BlockingIpApi 

Source
pub trait BlockingIpApi: IpApi {
    // Required methods
    fn query_api_default(
        &self,
        ip: &str,
    ) -> Result<IpDefaultResponse, IpApiError>;
    fn query_api_fully(&self, ip: &str) -> Result<IpFullResponse, IpApiError>;
    fn query_api<T>(&self, ip: &str) -> Result<T, IpApiError>
       where T: DeserializeOwned;
    fn get_http_client(&self) -> &Client;
}
Expand description

The blocking client for the ip-api.com API.

Required Methods§

Source

fn query_api_default(&self, ip: &str) -> Result<IpDefaultResponse, IpApiError>

Queries the API with the default fields.

§Arguments
  • ip - The IP address to query.
§Returns
  • IpDefaultResponse - The response from the API.
Source

fn query_api_fully(&self, ip: &str) -> Result<IpFullResponse, IpApiError>

Queries the API with all fields.

§Arguments
  • ip - The IP address to query.
§Returns
  • IpFullResponse - The response from the API.
Source

fn query_api<T>(&self, ip: &str) -> Result<T, IpApiError>

Queries the API with a custom struct.

§Arguments
  • ip - The IP address to query.
  • T - The custom struct to deserialize the response into.
§Returns
  • T - The response from the API.
Source

fn get_http_client(&self) -> &Client

Gets you the blocking http client.

§Returns
  • &reqwest::blocking::Client - The blocking http client.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§