Device Detection and IP Intelligence for the 51Degrees Pipeline, in Rust

lib.rs File Reference

Classes

struct  ProfileArguments
 The command-line arguments of an on-premise example that takes a data-file path and a performance profile. More...

Functions

pub const pub fn data_file_properties (data_file:&Path) -> Result< Vec< String > >
 The names of the properties the data file at data_file carries.
pub fn write_data_file_warnings (data_file:&Path, out:&mut dyn Write) -> Result<()>
 Write the standard lines about the data file at data_file, being its tier and publish date, then any warning that it is free data or more than 30 days old.
fn open_for_inspection (data_file:&Path) -> Result< IpIntelligenceOnPremiseEngine >
 An engine over data_file for reading what the file holds, with the low-memory profile and no updates.
pub struct ProfileArguments Argument (arguments:Arguments) -> Result< ProfileArguments > where Arguments:IntoIterator< Item=Argument >, Argument:AsRef< str >,
fn reads_the_profile_flag_in_both_spellings ()
fn takes_the_data_file_from_either_side_of_the_flag ()
fn no_arguments_give_no_file_and_no_profile ()
fn refuses_a_missing_or_unknown_profile ()

Variables

pub const ENTERPRISE_PROPERTIES
 Properties the Enterprise data file carries and neither free file does.
pub const CountryCode
pub const Town
pub const Latitude
pub const Longitude
pub const IsHosted
pub const IsVPN
pub const PROFILE_FLAG
 The flag that chooses the performance profile of an example that offers one, as --profile <name> or --profile=<name>.
pub struct ProfileArguments Arguments
 Read the arguments that follow the program name into [ProfileArguments].
pub data_file
 The first argument that is not [PROFILE_FLAG] or its value, being the path of the data file to open.
pub pub profile
 The profile [PROFILE_FLAG] names, when it is given.
mod tests

Function Documentation

◆ Argument()

pub struct ProfileArguments Argument ( arguments:Arguments ) -> Result< ProfileArguments > where Arguments:IntoIterator< Item=Argument >, Argument:AsRef< str >,

◆ data_file_properties()

pub const pub fn data_file_properties ( data_file:& Path) -> Result< Vec< String > >

The names of the properties the data file at data_file carries.

This opens a second engine over the same file with the low-memory profile, which leaves the data on disk, and no named properties, and asks it. The pipeline builder does not hand back its engine, and an engine built with named properties lists the names it was given, including any the file lacks.

◆ no_arguments_give_no_file_and_no_profile()

fn no_arguments_give_no_file_and_no_profile ( )

◆ open_for_inspection()

fn open_for_inspection ( data_file:& Path) -> Result< IpIntelligenceOnPremiseEngine >

An engine over data_file for reading what the file holds, with the low-memory profile and no updates.

◆ reads_the_profile_flag_in_both_spellings()

fn reads_the_profile_flag_in_both_spellings ( )

◆ refuses_a_missing_or_unknown_profile()

fn refuses_a_missing_or_unknown_profile ( )

◆ takes_the_data_file_from_either_side_of_the_flag()

fn takes_the_data_file_from_either_side_of_the_flag ( )

◆ write_data_file_warnings()

pub fn write_data_file_warnings ( data_file:& Path,
out:&mut dyn Write ) -> Result<()>

Write the standard lines about the data file at data_file, being its tier and publish date, then any warning that it is free data or more than 30 days old.

Opens a second engine over the file, as [data_file_properties] does.

Variable Documentation

◆ Arguments

pub struct ProfileArguments Arguments

Read the arguments that follow the program name into [ProfileArguments].

The name is read by [PerformanceProfile::parse], so HighPerformance and high-performance name the same profile. Fails when [PROFILE_FLAG] has no value or its value names no profile.

◆ CountryCode

pub const CountryCode

◆ data_file

pub data_file

The first argument that is not [PROFILE_FLAG] or its value, being the path of the data file to open.

◆ ENTERPRISE_PROPERTIES

pub const ENTERPRISE_PROPERTIES

Properties the Enterprise data file carries and neither free file does.

The on-premise examples ask for these alongside the free properties, and say where to ask about the Enterprise data file when the file in use does not carry them.

◆ IsHosted

pub const IsHosted

◆ IsVPN

pub const IsVPN

◆ Latitude

pub const Latitude

◆ Longitude

pub const Longitude

◆ profile

pub pub profile

The profile [PROFILE_FLAG] names, when it is given.

◆ PROFILE_FLAG

pub const PROFILE_FLAG

The flag that chooses the performance profile of an example that offers one, as --profile <name> or --profile=<name>.

◆ tests

mod tests
Initial value:
{
use super::*

◆ Town

pub const Town