Classes | |
| struct | ExampleOptions |
| Options the example runs with. More... | |
Functions | |
| pub struct ExampleOptions | run (options:ExampleOptions) -> Result<()> |
| Run the on-premise getting-started example. | |
| fn | representative_evidence () -> Vec<(&'static str, Vec<(&'static str, &'static str)>)> |
The representative evidence the example processes: a desktop and a mobile User-Agent, each as a labelled (key, value) pair list. | |
| fn | analyse_evidence (pipeline:&Arc< Pipeline >, label:&str, pairs:&[(&str, &str)], available:&[String],) -> Result<()> |
Process one evidence set and print the key device properties. available holds the properties the data file carries. | |
| fn | output_value< T:Display > (name:&str, value:&AspectPropertyValue< T >, message:&mut String) |
| Append one typed property to the output, handling the no-value case. | |
| fn | output_enterprise< T:Display > (name:&str, property:&str, value:&AspectPropertyValue< T >, available:&[String], message:&mut String,) |
| Append a property only the Enterprise data file carries, or say that it needs the Enterprise data file when the data file in use does not carry it. | |
| fn | main () -> Result<()> |
Resolve the data file then run the example. The data file is taken from the first command-line argument, the _51DEGREES_DD_PATH environment variable, or the Lite Hash file in the data repository inside the cxx submodule, which is downloaded when it is missing. With none of those present the example fails, after the resolver has printed the command that gets the file. | |
| fn | runs_against_the_lite_data_file () |
| Run the example end to end against the Lite Hash data file. | |
Variables | |
| const | CONTACT_US_URL |
| Where to ask about a copy of the Enterprise data file. | |
| const & | str |
| pub | data_file |
| The path to the on-premise Hash data file the engine loads. | |
| pub pub | profile |
| The performance profile to load the data file with. | |
| mod | tests |
Function Documentation
◆ analyse_evidence()
| fn analyse_evidence | ( | pipeline:&Arc< Pipeline > | , |
| label:& | str, | ||
| pairs:& | [(&str, &str)], | ||
| available:& | [String] ) -> Result<()> |
Process one evidence set and print the key device properties. available holds the properties the data file carries.
◆ main()
| fn main | ( | ) | -> Result<()> |
Resolve the data file then run the example. The data file is taken from the first command-line argument, the _51DEGREES_DD_PATH environment variable, or the Lite Hash file in the data repository inside the cxx submodule, which is downloaded when it is missing. With none of those present the example fails, after the resolver has printed the command that gets the file.
◆ output_enterprise< T:Display >()
| fn output_enterprise< T:Display > | ( | name:& | str, |
| property:& | str, | ||
| value:&AspectPropertyValue< T > | , | ||
| available:& | [String], | ||
| message:&mut | String ) |
Append a property only the Enterprise data file carries, or say that it needs the Enterprise data file when the data file in use does not carry it.
◆ output_value< T:Display >()
Append one typed property to the output, handling the no-value case.
An [AspectPropertyValue] behaves like a nullable type: accessing the value of a no-value instance is an error, so the no-value message is printed instead.
◆ representative_evidence()
The representative evidence the example processes: a desktop and a mobile User-Agent, each as a labelled (key, value) pair list.
◆ run()
| pub struct ExampleOptions run | ( | options:ExampleOptions | ) | -> Result<()> |
Run the on-premise getting-started example.
Builds an on-premise device-detection pipeline from the Hash data file, then runs a desktop and a mobile User-Agent through it, printing the strongly-typed IsMobile, PlatformName, PlatformVersion, BrowserName, BrowserVersion and DeviceId results for each, then the Enterprise properties. Finishes by printing the standard data-file warnings (Lite tier, more-than-30-days-old), the Enterprise properties the data file does not carry with where to ask about a copy, and the "Find out more" links.
◆ runs_against_the_lite_data_file()
| fn runs_against_the_lite_data_file | ( | ) |
Run the example end to end against the Lite Hash data file.
On-premise tests run for real against the Lite file. The test is skipped (not failed) only when no data file can be located, so a checkout without the submodule keeps cargo test green while a developer with it gets genuine coverage.
Variable Documentation
◆ CONTACT_US_URL
| const CONTACT_US_URL |
Where to ask about a copy of the Enterprise data file.
◆ data_file
| pub data_file |
The path to the on-premise Hash data file the engine loads.
◆ profile
| pub pub profile |
The performance profile to load the data file with.
The example uses the low-memory profile, whose performance is sufficient here.
◆ str
| const & str |
◆ tests
| mod tests |
