Classes | |
| struct | DisplayValue |
| One displayed IP-intelligence property reduced to its plain value, ready to render. More... | |
Functions | |
| pub struct DisplayValue | T (property:&str, label:&str, value:&AspectPropertyValue< T >, render:impl Fn(&T) -> String,) -> DisplayValue |
Reduce a plain [AspectPropertyValue] to its display value, rendering the value with the supplied closure. | |
| fn | display_weighted (property:&str, label:&str, value:&AspectPropertyValue< Vec< WeightedValue< String > > >,) -> DisplayValue |
Reduce a weighted [AspectPropertyValue] to its display value, rendering each candidate as value (weight) ordered high weighting first and joined with commas. | |
| pub fn | display_values (ip:&dyn IpIntelligenceData) -> Vec< DisplayValue > |
| Gather the displayed IP-intelligence properties from the result, read through the strongly-typed accessors. | |
| pub fn | mark_enterprise_only (values:&mut[DisplayValue], available:&[String]) |
| Replace the value of each row for a property only the Enterprise data file carries, when the data file in use does not carry it, with a note saying so. | |
| pub fn | enterprise_message_html (missing:&[&str]) -> String |
| A message naming the Enterprise properties the data file does not carry, with a link to ask about a copy of the Enterprise data file. | |
| pub fn | find_out_more_html (repositories:&[&str]) -> String |
| The "Find out more" section that ends every page, set apart by a rule. | |
| pub fn | results_table (values:&[DisplayValue]) -> String |
Render the server-side IP-intelligence results as a two-column .c-eg-table (property, value). | |
| pub fn | coordinates (ip:&dyn IpIntelligenceData) -> Option<(String, String)> |
| Extract the latitude and longitude from the result as display strings, if both resolved to a value. | |
| pub fn | map_init_script (coordinates:&Option<(String, String)>) -> String |
Build the inline <script> that initializes the Leaflet location map for the supplied coordinates. | |
Variables | |
| pub const | ENTERPRISE_CONTACT_URL |
| Where to ask about a copy of the Enterprise data file. | |
| pub const & | str |
| pub | property |
The property's name, such as CountryCode. | |
| pub pub | label |
| The human-readable label for the property row. | |
| pub pub pub | value |
| The resolved value, or the no-value message. | |
| const | MAP_SECTION_ID |
The default DOM ids the shared fodExamples.initLocationMap helper uses. | |
| const | MAP_CANVAS_ID |
| pub const | CLOUD_CONTACT_BANNER |
| The contact-us banner shown on the cloud page, inviting the reader to discuss an on-premise deployment. | |
| pub const which resolves a limited set of network and location properties A paid Enterprise data file adds far more detailed and accurate | location |
Function Documentation
◆ coordinates()
| pub fn coordinates | ( | ip:&dyn | IpIntelligenceData | ) | -> Option<(String, String)> |
Extract the latitude and longitude from the result as display strings, if both resolved to a value.
These feed the location map.
◆ display_values()
| pub fn display_values | ( | ip:&dyn | IpIntelligenceData | ) | -> Vec< DisplayValue > |
Gather the displayed IP-intelligence properties from the result, read through the strongly-typed accessors.
The order is the autonomous system and network registration first, then the textual location, the coordinates and accuracy, then the network flags and the weighted country-code distributions.
Plain properties (strings, the [f32] coordinates, the [i32] radii and the [bool] flags) resolve to a single value. The weighted properties at the end (CountryCodesGeographical, CountryCodesPopulation, Mcc) resolve to a weighted list, shown as value (weight) pairs.
◆ display_weighted()
| fn display_weighted | ( | property:& | str, |
| label:& | str, | ||
| value:&AspectPropertyValue< Vec< WeightedValue< String > > > | ) -> DisplayValue |
Reduce a weighted [AspectPropertyValue] to its display value, rendering each candidate as value (weight) ordered high weighting first and joined with commas.
A no-value carries the engine's explanation.
This is how a weighted property is shown: a single IP can overlap several countries, so the value is a weighted list rather than one definite value.
◆ enterprise_message_html()
| pub fn enterprise_message_html | ( | missing:& | [&str] | ) | -> String |
A message naming the Enterprise properties the data file does not carry, with a link to ask about a copy of the Enterprise data file.
Empty when missing is empty.
◆ find_out_more_html()
| pub fn find_out_more_html | ( | repositories:& | [&str] | ) | -> String |
The "Find out more" section that ends every page, set apart by a rule.
It lists [FIND_OUT_MORE] and then each of repositories as a bare address.
◆ map_init_script()
| pub fn map_init_script | ( | coordinates:&Option<(String, String)> | ) | -> String |
Build the inline <script> that initializes the Leaflet location map for the supplied coordinates.
When no coordinates resolved the map stays hidden and an empty string is returned, so the page renders without a map.
◆ mark_enterprise_only()
| pub fn mark_enterprise_only | ( | values:& | mut[DisplayValue], |
| available:& | [String] ) |
Replace the value of each row for a property only the Enterprise data file carries, when the data file in use does not carry it, with a note saying so.
available holds the properties the data file carries.
◆ results_table()
| pub fn results_table | ( | values:& | [DisplayValue] | ) | -> String |
Render the server-side IP-intelligence results as a two-column .c-eg-table (property, value).
◆ T()
| pub struct DisplayValue T | ( | property:& | str, |
| label:& | str, | ||
| value:&AspectPropertyValue< T > | , | ||
| render:impl Fn &T -> | String ) -> DisplayValue |
Reduce a plain [AspectPropertyValue] to its display value, rendering the value with the supplied closure.
A no-value carries the engine's explanation.
Variable Documentation
◆ CLOUD_CONTACT_BANNER
| pub const CLOUD_CONTACT_BANNER |
The contact-us banner shown on the cloud page, inviting the reader to discuss an on-premise deployment.
◆ ENTERPRISE_CONTACT_URL
| pub const ENTERPRISE_CONTACT_URL |
Where to ask about a copy of the Enterprise data file.
◆ label
| pub pub label |
The human-readable label for the property row.
◆ location
| pub const which resolves a limited set of network and location properties A paid Enterprise data file adds far more detailed and accurate location |
◆ MAP_CANVAS_ID
| const MAP_CANVAS_ID |
◆ MAP_SECTION_ID
| const MAP_SECTION_ID |
The default DOM ids the shared fodExamples.initLocationMap helper uses.
They are emitted in [render_page] and referenced by [map_init_script].
◆ property
| pub property |
The property's name, such as CountryCode.
◆ str
| pub const & str |
◆ value
| pub pub pub value |
The resolved value, or the no-value message.
