Expand description

The client (based on ip-api.com API) allows you to get information about the IP address

Example

use ip_api_client as Client;
use ip_api_client::IpData;

// You can
// `generate_empty_config` (to create your own config from scratch)
// `generate_minimum_config` (that includes only important fields)
// `generate_maximum_config` (that includes all fields)
let ip_data: IpData = Client::generate_empty_config()
    // or `exclude_country` if this field is already included in the generated config
    .include_country()
    // or `exclude_currency` if this field is already included in the generated config
    .include_currency()
    // `make_request` takes "ip"/"domain"/"empty string (if you want to request your ip)"
    .make_request("1.1.1.1").unwrap();

println!("{}'s national currency is {}", ip_data.country.unwrap(), ip_data.currency.unwrap());

Structs

Configuration structure allows you to customize the requested fields in the request to save traffic

The data that will be received after the making a request

Enums

Represents all the ways that a request can fail

Functions

Create an empty config to create your own from scratch

Generate maximum config that includes all fields

Generate minimum config that includes only important fields