Skip to main content

IpIntelligenceDataBase

Struct IpIntelligenceDataBase 

Source
pub struct IpIntelligenceDataBase { /* private fields */ }
Expand description

The concrete IP-intelligence element data both engines produce.

Embeds an AspectDataBase for the standard aspect plumbing (the dynamic property bag, the engine keys and the cache-hit flag) and keeps the typed values in dedicated stores next to it: one plain store per value type, plus a weighted store for the genuinely weighted properties. The generated IpIntelligenceData accessors read these stores by name; the dynamic ElementData bag holds a mirror so string-keyed lookups also work.

Implementations§

Source§

impl IpIntelligenceDataBase

Source

pub fn new(engine_key: impl Into<String>) -> Self

Create empty IP-intelligence data attributed to the engine with the given data key (typically IP_DATA_KEY_NAME).

Source

pub fn from_base(base: AspectDataBase) -> Self

Create IP-intelligence data wrapping an existing AspectDataBase, preserving its bag, engine keys and cache-hit flag.

Source

pub fn base(&self) -> &AspectDataBase

Borrow the embedded AspectDataBase.

Source

pub fn base_mut(&mut self) -> &mut AspectDataBase

Mutably borrow the embedded AspectDataBase.

Source

pub fn set_cache_hit(&mut self)

Mark this data as having been served from a cache hit.

Source

pub fn add_engine_key(&mut self, engine_key: impl Into<String>)

Record that another engine (by data key) also contributed to this data.

Source

pub fn set_string(&mut self, name: impl AsRef<str>, value: impl Into<String>)

Store a plain string-valued property and its dynamic-bag mirror.

This is the entry point a wrapper calls for the registered-range and textual location properties (including the IP range bounds). The property name is matched case-insensitively by the accessors and the dynamic bag.

Source

pub fn set_float(&mut self, name: impl AsRef<str>, value: f32)

Store a plain single-precision float property (Latitude, Longitude) and its dynamic-bag mirror.

Source

pub fn set_integer(&mut self, name: impl AsRef<str>, value: i32)

Store a plain integer property (TimeZoneOffset, AccuracyRadiusMin, the diversity scores) and its dynamic-bag mirror.

Source

pub fn set_boolean(&mut self, name: impl AsRef<str>, value: bool)

Store a plain boolean property (IsBroadband, IsVPN, IsEu, and the rest of the network flags) and its dynamic-bag mirror.

Source

pub fn set_weighted_string( &mut self, name: impl AsRef<str>, values: Vec<WeightedValue<String>>, )

Store a weighted string property (CountryCodesGeographical, CountryCodesPopulation, Mcc) and its dynamic-bag mirror.

The list is sorted high weighting first and mirrored into the dynamic bag as a PropertyValue::KeyValueList of value/weight records.

Source

pub fn set_string_no_value( &mut self, name: impl AsRef<str>, message: impl Into<String>, )

Record that a string-valued property had no value, with an explanatory message. The matching accessor then returns a no-value carrying it.

Source

pub fn set_float_no_value( &mut self, name: impl AsRef<str>, message: impl Into<String>, )

Record that a float-valued property had no value, with a message.

Source

pub fn set_integer_no_value( &mut self, name: impl AsRef<str>, message: impl Into<String>, )

Record that an integer property had no value, with a message.

Source

pub fn set_boolean_no_value( &mut self, name: impl AsRef<str>, message: impl Into<String>, )

Record that a boolean property had no value, with a message.

Source

pub fn set_weighted_string_no_value( &mut self, name: impl AsRef<str>, message: impl Into<String>, )

Record that a weighted string property had no value, with a message.

Source

pub fn string(&self, name: &str) -> AspectPropertyValue<String>

Read a plain string property by name, as the generated string accessors do.

Source

pub fn float(&self, name: &str) -> AspectPropertyValue<f32>

Read a plain float property by name.

Source

pub fn integer(&self, name: &str) -> AspectPropertyValue<i32>

Read a plain integer property by name.

Source

pub fn boolean(&self, name: &str) -> AspectPropertyValue<bool>

Read a plain boolean property by name.

Source

pub fn weighted_string( &self, name: &str, ) -> AspectPropertyValue<Vec<WeightedValue<String>>>

Read a weighted string property by name.

Returns AspectPropertyValue::NoValue when the property is absent or was recorded as a no-value. The list is ordered high weighting first. This is how the genuinely weighted properties (CountryCodesGeographical, CountryCodesPopulation, Mcc) are read.

Trait Implementations§

Source§

impl AspectData for IpIntelligenceDataBase

Source§

fn engine_keys(&self) -> &[String]

The data keys of the engines that contributed to this data. Read more
Source§

fn cache_hit(&self) -> bool

True if this data instance was the result of a cache hit rather than the engine processing the evidence. Read more
Source§

impl Clone for IpIntelligenceDataBase

Source§

fn clone(&self) -> IpIntelligenceDataBase

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IpIntelligenceDataBase

Source§

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

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

impl ElementData for IpIntelligenceDataBase

Source§

fn get(&self, name: &str) -> Result<PropertyValue, NoValueError>

Get a property value by name. Read more
Source§

fn keys(&self) -> Vec<String>

List the property names available in this data. The order is unspecified.
Source§

fn as_any(&self) -> &dyn Any

Borrow this value as &dyn Any for downcasting to the concrete type.
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Borrow this value as &mut dyn Any for downcasting to the concrete type.
Source§

impl IpIntelligenceData for IpIntelligenceDataBase

Source§

fn accuracy_radius_max(&self) -> AspectPropertyValue<i32>

Radius in kilometers of the circle centred around the most probable location that encompasses the entire area. Where multiple areas are returned, this will only cover the area the most probable location is in. See Areas property. This will likely be a very large distance. It is recommend to use the AccuracyRadiusMin property.
Source§

fn accuracy_radius_min(&self) -> AspectPropertyValue<i32>

Radius in kilometers of the largest circle centred around the most probable location that fits within the area. Where multiple areas are returned, only the area that the most probable location falls within is considered. See Areas property.
Source§

fn areas(&self) -> AspectPropertyValue<String>

Any shapes associated with the location. Usually this is the area which the IP range covers. This is returned as a WKT String stored as a reduced format of WKB.
Source§

fn asn(&self) -> AspectPropertyValue<String>

Autonomous System Number associated with the IP address.
Source§

fn asn_name(&self) -> AspectPropertyValue<String>

The name registered to the Asn associated with the IP address.
Source§

fn browser_diversity(&self) -> AspectPropertyValue<i32>

Refers to the diversity of browsers observed from the IP range. An integer between 1-10, a lower value indicates a low number of browsers seen per IP address, while a higher value indicates a high number of browsers seen per IP address. A 0 value indicates that the probability is unknown.
Source§

fn connection_type(&self) -> AspectPropertyValue<String>

Indicates the type of connection being used. Returns either Broadband, Cellular, or Hosting and Anonymous.
Source§

fn continent_code2(&self) -> AspectPropertyValue<String>

The 3-character ISO 3166-1 continent code for the supplied location.
Source§

fn continent_name(&self) -> AspectPropertyValue<String>

The name of the continent the supplied location is in.
Source§

fn country(&self) -> AspectPropertyValue<String>

The name of the country that the supplied location is in.
Source§

fn country_code(&self) -> AspectPropertyValue<String>

The 2-character ISO 3166-1 code of the country that the supplied location is in.
Source§

fn country_code3(&self) -> AspectPropertyValue<String>

The 3-character ISO 3166-1 alpha-3 code of the country that the supplied location is in.
Source§

fn country_codes_geographical( &self, ) -> AspectPropertyValue<Vec<WeightedValue<String>>>

A list of countries in ISO 3166-1 alpha-2 country code format that overlap with the area likely associated with the provided evidence, weighted and ordered by each country’s proportion of the area. Administrative areas that cannot be cleanly resolved to the country level will not contribute to the resulting data.
Source§

fn country_codes_population( &self, ) -> AspectPropertyValue<Vec<WeightedValue<String>>>

A list of countries in ISO 3166-1 alpha-2 country code format that overlap with the area likely associated with the provided evidence, weighted and ordered by each country’s proportion of the total population within the area. Administrative areas that cannot be cleanly resolved to the country level will not contribute to the resulting data.
Source§

fn county(&self) -> AspectPropertyValue<String>

The name of the county that the supplied location is in. In this case, a county is defined as an administrative sub-section of a country or state.
Source§

fn currency_code(&self) -> AspectPropertyValue<String>

The Alpha-3 ISO 4217 code of the currency associated with the supplied location.
Source§

fn dial_code(&self) -> AspectPropertyValue<String>

ITU international telephone numbering plan code for the country.
Source§

fn hardware_diversity(&self) -> AspectPropertyValue<i32>

Refers to the diversity of hardware devices observed from the IP range. An integer between 1-10, a lower value indicates a low number of devices seen per IP address, while a higher value indicates a high number of devices seen per IP address. A 0 value indicates that the probability is unknown.
Source§

fn human_probability(&self) -> AspectPropertyValue<i32>

The confidence that the IP address is a human user versus associated with hosting. A 0-10 value where; 0-3: Low confidence the user is human, 4-6: Medium confidence, 7-10: High confidence. A -1 value indicates that the probability is unknown.
Source§

fn ip(&self) -> AspectPropertyValue<String>

The IPv4 address of the request.
Source§

fn ip_range_end(&self) -> AspectPropertyValue<String>

End of the IP range to which the evidence IP belongs.
Source§

fn ip_range_start(&self) -> AspectPropertyValue<String>

Start of the IP range to which the evidence IP belongs.
Source§

fn ip_v6(&self) -> AspectPropertyValue<String>

The IPv6 address of the request.
Source§

fn is_broadband(&self) -> AspectPropertyValue<bool>

Indicates whether the IP address is associated with a broadband connection. Includes DSL, Cable, Fibre, and Satellite connections.
Source§

fn is_cellular(&self) -> AspectPropertyValue<bool>

Indicates whether the IP address is associated with a cellular network.
Source§

fn is_eu(&self) -> AspectPropertyValue<bool>

Indicates whether the country of the supplied location is within the European Union.
Source§

fn is_hosted(&self) -> AspectPropertyValue<bool>

Indicates whether the IP address is associated with hosting. Includes both hosting and anonymised connections such as hosting networks, hosting ASNs, VPNs, proxies, TOR networks, and unreachable IP addresses.
Source§

fn iso31662_lvl4(&self) -> AspectPropertyValue<String>

The ISO 3166-2 code for the supplied location. This is using the ‘ISO3166-2-lvl4’ property from OpenStreetMap.
Source§

fn iso31662_lvl4_subdivision_only(&self) -> AspectPropertyValue<String>

The alphanumeric code representing the subdivision from the ISO 3166-2 code of the supplied location. This is using the ‘ISO3166-2-lvl4’ property from OpenStreetMap.
Source§

fn iso31662_lvl8(&self) -> AspectPropertyValue<String>

The ISO 3166-2 code for the supplied location. This is using the ‘ISO3166-2-lvl8’ property from OpenStreetMap.
Source§

fn iso31662_lvl8_subdivision_only(&self) -> AspectPropertyValue<String>

The alphanumeric code representing the subdivision from the ISO 3166-2 code of the supplied location. This is using the ‘ISO3166-2-lvl8’ property from OpenStreetMap.
Source§

fn is_proxy(&self) -> AspectPropertyValue<bool>

Indicates whether the IP address is associated with a Proxy server.
Source§

fn is_public_router(&self) -> AspectPropertyValue<bool>

Indicates whether the IP address is associated with a public router.
Source§

fn is_tor(&self) -> AspectPropertyValue<bool>

Indicates whether the IP address is associated with a TOR server.
Source§

fn is_vpn(&self) -> AspectPropertyValue<bool>

Indicates whether the IP address is associated with a VPN server.
Source§

fn language_code(&self) -> AspectPropertyValue<String>

The Alpha-2 ISO 639 Language code associated with the supplied location.
Source§

fn latitude(&self) -> AspectPropertyValue<f32>

Average latitude of the IP. For privacy, this is randomized within around 1 kilometer of the result. Randomized result will change only once per day.
Source§

fn location_confidence(&self) -> AspectPropertyValue<String>

The confidence in the town and country provided.
Source§

fn longitude(&self) -> AspectPropertyValue<f32>

Average longitude of the IP. For privacy, this is randomized within around 1 kilometer of the result. Randomized result will change only once per day.
Source§

fn mcc(&self) -> AspectPropertyValue<Vec<WeightedValue<String>>>

The mobile country code of the network the device is connected to.
Source§

fn platform_diversity(&self) -> AspectPropertyValue<i32>

Refers to the diversity of software observed from the IP range. An integer between 1-10, a lower value indicates a low number of software seen per IP address, while a higher value indicates a high number of software seen per IP address. A 0 value indicates that the probability is unknown.
Source§

fn region(&self) -> AspectPropertyValue<String>

The name of the geographical region that the supplied location is in.
Source§

fn registered_country(&self) -> AspectPropertyValue<String>

Country code of the registered range.
Source§

fn registered_name(&self) -> AspectPropertyValue<String>

Name of the IP range. This is usually the owner.
Source§

fn registered_owner(&self) -> AspectPropertyValue<String>

Registered owner of the range.
Source§

fn state(&self) -> AspectPropertyValue<String>

The name of the state that the supplied location is in.
Source§

fn suburb(&self) -> AspectPropertyValue<String>

The name of the suburb that the supplied location is in.
Source§

fn time_zone_iana(&self) -> AspectPropertyValue<String>

The time zone at the supplied location in the IANA Time Zone format.
Source§

fn time_zone_offset(&self) -> AspectPropertyValue<i32>

The offset from UTC in minutes in the supplied location, at the time that the value is produced.
Source§

fn town(&self) -> AspectPropertyValue<String>

The name of the town that the supplied location is in.
Source§

fn zip_code(&self) -> AspectPropertyValue<String>

The zip or postal code that the supplied location falls under.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.