Skip to main content

parse_value

Function parse_value 

Source
pub fn parse_value(s: &str) -> Result<PropertyValue, String>
Expand description

Parse a write value from a string, with no property to say its datatype. parse_value_for reads names and named bits for a known property.

Accepts:

  • null → PropertyValue::Null
  • true/false → PropertyValue::Boolean
  • active → PropertyValue::Enumerated(1), inactive → PropertyValue::Enumerated(0)
  • Integer without decimal: 42 → PropertyValue::Unsigned, negative → PropertyValue::Signed
  • Float with decimal: 72.5 → PropertyValue::Real
  • Quoted string: "hello" → PropertyValue::CharacterString
  • enumerated:3 → PropertyValue::Enumerated(3)
  • bits(0101) → PropertyValue::BitString, first bit first
  • dates, times and date-times as the formatter prints them, bare or after date:/time:: 2026-10-19, 2026-10-19 Mon, *-*-* Fri, 07:00, 14:30:05.25, any date, any time; a date and a time (2026-10-19 07:00, or unspecified) is a BACnetDateTime, a Date then a Time
  • object:ai:1 → PropertyValue::ObjectIdentifier