Classes | |
| struct | ExampleOptions |
| Options the example runs with. More... | |
Functions | |
| pub fn | run (options:&ExampleOptions, out:&mut dyn Write) -> anyhow::Result<()> |
Run the compare example, writing all output to out. | |
| fn | lookup (data_file:&std::path::Path, profile:PerformanceProfile, ip:&str, available:&[String],) -> anyhow::Result< Vec< String > > |
| Build a pipeline for one profile and look an IP up, returning the rendered value of each compared property. | |
| fn | compare_across_profiles (options:&ExampleOptions, available:&[String], out:&mut dyn Write,) -> anyhow::Result<()> |
| Look the first IP up under each profile and show the results side by side, confirming that the choice of profile does not change the result. | |
| fn | compare_two_ips (options:&ExampleOptions, available:&[String], out:&mut dyn Write,) -> anyhow::Result<()> |
| Compare the two IP addresses against each other under one profile. | |
| fn | main () -> anyhow::Result<()> |
| Read the data file, then run the example, writing to standard output. | |
| fn | compare_runs_across_profiles_and_ips () |
Variables | |
| const | CONTACT_US_URL |
| Where to ask about a copy of the Enterprise data file. | |
| const & | str |
| pub struct ExampleOptions | PerformanceProfile = PerformanceProfile::LowMemory |
The profile the two IP addresses are compared under unless --profile names another. | |
| const | FASTER_PROFILE_COMMAND |
| The command that compares the two IP addresses with the faster profile. | |
| impl | ExampleOptions |
| const | ENTERPRISE_COMPARED |
| The compared properties only the Enterprise data file carries. | |
| const | Town |
| const | REQUESTED_PROPERTIES |
| The properties the pipeline is asked for. | |
| const | AsnName |
| const | RegisteredName |
| const | Country |
| mod | tests |
Function Documentation
◆ compare_across_profiles()
| fn compare_across_profiles | ( | options:& | ExampleOptions, |
| available:& | [String], | ||
| out:&mut dyn | Write ) -> anyhow::Result<()> |
Look the first IP up under each profile and show the results side by side, confirming that the choice of profile does not change the result.
◆ compare_runs_across_profiles_and_ips()
| fn compare_runs_across_profiles_and_ips | ( | ) |
◆ compare_two_ips()
| fn compare_two_ips | ( | options:& | ExampleOptions, |
| available:& | [String], | ||
| out:&mut dyn | Write ) -> anyhow::Result<()> |
Compare the two IP addresses against each other under one profile.
◆ lookup()
| fn lookup | ( | data_file:&std::path::Path | , |
| profile:PerformanceProfile | , | ||
| ip:& | str, | ||
| available:& | [String] ) -> anyhow::Result< Vec< String > > |
Build a pipeline for one profile and look an IP up, returning the rendered value of each compared property.
available holds the properties the data file carries.
◆ main()
| fn main | ( | ) | -> anyhow::Result<()> |
Read the data file, then run the example, writing to standard output.
◆ run()
| pub fn run | ( | options:& | ExampleOptions, |
| out:&mut dyn | Write ) -> anyhow::Result<()> |
Run the compare example, writing all output to out.
Usage sharing is not enabled, as this is a console example.
Variable Documentation
◆ AsnName
| const AsnName |
◆ CONTACT_US_URL
| const CONTACT_US_URL |
Where to ask about a copy of the Enterprise data file.
◆ Country
| const Country |
◆ ENTERPRISE_COMPARED
| const ENTERPRISE_COMPARED |
The compared properties only the Enterprise data file carries.
◆ ExampleOptions
| impl ExampleOptions |
◆ FASTER_PROFILE_COMMAND
| const FASTER_PROFILE_COMMAND |
The command that compares the two IP addresses with the faster profile.
◆ PerformanceProfile
| pub struct ExampleOptions PerformanceProfile = PerformanceProfile::LowMemory |
The profile the two IP addresses are compared under unless --profile names another.
LowMemory reads the data file from disk, so the comparison needs little memory even with the Enterprise file, which is over 6 GB. Reading from disk is much slower, and the .NET metrics example read a profile's values about 166 times a second with LowMemory against 2,013 with the file held in memory, so --profile HighPerformance is offered where there is memory for the whole file.
◆ RegisteredName
| const RegisteredName |
◆ REQUESTED_PROPERTIES
| const REQUESTED_PROPERTIES |
The properties the pipeline is asked for.
AsnName and RegisteredName are included so the request holds a property each free file carries, because a data file opens only when it carries at least one property asked for.
◆ str
| const & str |
◆ tests
| mod tests |
◆ Town
| const Town |
