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

properties.rs File Reference

Functions

pub fn get_property_as_string (data:&dyn ElementData, name:&str) -> String
 Read the property name from data and render it as a display string.
pub fn property_value_to_string (value:&PropertyValue) -> String
 Render a single [PropertyValue] to a string using the rules described on [get_property_as_string].
fn bag () -> MapElementData
fn renders_scalar_values ()
fn is_case_insensitive ()
fn joins_list_values ()
fn missing_property_returns_marker ()
fn renders_key_value_list ()

Variables

pub const NO_VALUE_MARKER
 The marker returned when a property is absent from the element data, or present but has no value (the null-values rule).
mod tests

Function Documentation

◆ bag()

fn bag ( ) -> MapElementData

◆ get_property_as_string()

pub fn get_property_as_string ( data:&dyn ElementData,
name:& str ) -> String

Read the property name from data and render it as a display string.

Looks the property up in the dynamic bag ([ElementData::get], which matches names case-insensitively) and formats the result:

  • a string or JavaScript value is returned as-is,
  • a boolean, integer or double is formatted with its natural Display,
  • a list of strings is joined with ", ",
  • a list of key-value collections is rendered compactly as [{k=v, ...}, ...].

When the property is missing, or present but holds no value, the [NO_VALUE_MARKER] is returned so the caller always gets a printable string.

◆ is_case_insensitive()

fn is_case_insensitive ( )

◆ joins_list_values()

fn joins_list_values ( )

◆ missing_property_returns_marker()

fn missing_property_returns_marker ( )

◆ property_value_to_string()

pub fn property_value_to_string ( value:& PropertyValue) -> String

Render a single [PropertyValue] to a string using the rules described on [get_property_as_string].

◆ renders_key_value_list()

fn renders_key_value_list ( )

◆ renders_scalar_values()

fn renders_scalar_values ( )

Variable Documentation

◆ NO_VALUE_MARKER

pub const NO_VALUE_MARKER

The marker returned when a property is absent from the element data, or present but has no value (the null-values rule).

◆ tests

mod tests
Initial value:
{
use super::*