IpData

Struct IpData 

Source
pub struct IpData { /* private fields */ }

Implementations§

Source§

impl IpData

Source

pub fn ip(&self) -> Result<IpAddr, AddrParseError>

Returns the IP address that was looked up.

Source

pub fn is_eu(&self) -> bool

Returns true or false depending on whether the country is a recognized member of the European Union. The list of all EU countries is compiled from the European Union website: https://europa.eu/european-union/about-eu/countries_en.

Source

pub fn city(&self) -> &String

Returns the name of the city where the IP Address is located.

Source

pub fn region(&self) -> &String

Returns the name of the region where the IP address is located.

Source

pub fn region_code(&self) -> &String

Returns the ISO 3166-2 region code for the IP address.

Source

pub fn country_name(&self) -> &String

Returns the country name where the IP address is located.

Source

pub fn country_code(&self) -> &String

Returns the 2 letter ISO 3166-1 alpha-2 code for the country where the IP address is located.

Source

pub fn continent_name(&self) -> &String

Returns the name of the continent where the IP Address is located. One of Africa, Antarctica, Asia, Europe, North America, Oceania, South America.

Source

pub fn latitude(&self) -> f64

Returns an approximate latitudinal location for the IP Address. Often near the center of population.

Examples found in repository?
examples/lookup.rs (line 13)
5fn main() {
6    let ip = net::Ipv4Addr::new(1,1,1,1);
7    let resp = ipdata::lookup(net::IpAddr::V4(ip));
8
9    match resp {
10        Ok(resp) => {
11            println!("{}: {}, {}",
12                     resp.organization(),
13                     resp.latitude(), resp.longitude());
14        }
15        Err(err) => {
16            eprintln!("error: {}", err);
17            ::std::process::exit(1);
18        }
19    }
20}
Source

pub fn longitude(&self) -> f64

Returns an approximate longitudinal location for the IP Address. Often near the center of population.

Examples found in repository?
examples/lookup.rs (line 13)
5fn main() {
6    let ip = net::Ipv4Addr::new(1,1,1,1);
7    let resp = ipdata::lookup(net::IpAddr::V4(ip));
8
9    match resp {
10        Ok(resp) => {
11            println!("{}: {}, {}",
12                     resp.organization(),
13                     resp.latitude(), resp.longitude());
14        }
15        Err(err) => {
16            eprintln!("error: {}", err);
17            ::std::process::exit(1);
18        }
19    }
20}
Source

pub fn asn(&self) -> &String

Returns the Autonomous System Number that references the IP Address’s owning organization.

Source

pub fn organization(&self) -> &String

Returns the name of the Organisation that owns the IP Address. This will default to the ISP name if the organisation is not available.

Examples found in repository?
examples/lookup.rs (line 12)
5fn main() {
6    let ip = net::Ipv4Addr::new(1,1,1,1);
7    let resp = ipdata::lookup(net::IpAddr::V4(ip));
8
9    match resp {
10        Ok(resp) => {
11            println!("{}: {}, {}",
12                     resp.organization(),
13                     resp.latitude(), resp.longitude());
14        }
15        Err(err) => {
16            eprintln!("error: {}", err);
17            ::std::process::exit(1);
18        }
19    }
20}
Source

pub fn postal(&self) -> &String

Returns the postal code where the IP address is located.

Source

pub fn calling_code(&self) -> &String

Returns the international calling code where the IP adress is located.

Source

pub fn flag(&self) -> &String

Returns a URL to a PNG image with the flag of the country where the IP address is located.

Source

pub fn emoji_flag(&self) -> &String

Returns an emoji version of the flag of the country where the IP address is located.

Source

pub fn emoji_unicode(&self) -> &String

Returns the country flag emoji in unicode.

Source

pub fn languages(&self) -> &Vec<Language>

Returns the location’s languages.

Source

pub fn currency(&self) -> &Currency

Returns the location’s local currency.

Source

pub fn time_zone(&self) -> &TimeZone

Returns the locations local time zone.

Source

pub fn threat(&self) -> &Threat

Returns known threat data about the IP.

Source

pub fn count(&self) -> u64

The total number of requests made by your API key in the last 24 hrs. Updates once a minute.

Source

pub fn carrier(&self) -> &Option<Carrier>

Returns details of the IP Addresses’s mobile carrier, if available.

Trait Implementations§

Source§

impl Debug for IpData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for IpData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

§

impl Freeze for IpData

§

impl RefUnwindSafe for IpData

§

impl Send for IpData

§

impl Sync for IpData

§

impl Unpin for IpData

§

impl UnwindSafe for IpData

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Err = <U as TryFrom<T>>::Err

Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Err>

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,